From: Jan Kiszka <[email protected]>

EFI_DT_INSTALL_TABLE is not an official flag according to [1]. It just
still exists in U-Boot for historic reasons. Avoid it by using
InstallConfigurationTable instead - a code path that can easily be
shared with the no-fixup-available case.

[1] https://github.com/U-Boot-EFI/EFI_DT_FIXUP_PROTOCOL

Reported-by: Heinrich Schuchardt <[email protected]>
Signed-off-by: Jan Kiszka <[email protected]>
---
 kernel-stub/fdt.c | 44 +++++++++++++++++++++-----------------------
 1 file changed, 21 insertions(+), 23 deletions(-)

diff --git a/kernel-stub/fdt.c b/kernel-stub/fdt.c
index a832660..e6fe410 100644
--- a/kernel-stub/fdt.c
+++ b/kernel-stub/fdt.c
@@ -185,37 +185,35 @@ EFI_STATUS replace_fdt(const VOID *fdt)
                if (!fdt_buffer) {
                        return EFI_OUT_OF_RESOURCES;
                }
+       } else {
+               /* Find out which size we need */
+               size = 0;
+               status = protocol->Fixup(protocol, (VOID *) fdt, &size,
+                                        EFI_DT_APPLY_FIXUPS);
+               if (status != EFI_BUFFER_TOO_SMALL) {
+                       error(L"Device tree fixup: unexpected error", status);
+                       return status;
+               }
+
+               fdt_buffer = clone_fdt(fdt, size);
+               if (!fdt_buffer) {
+                       return EFI_OUT_OF_RESOURCES;
+               }
 
-               status = BS->InstallConfigurationTable(&EfiDtbTableGuid,
-                                                      fdt_buffer);
+               status = protocol->Fixup(protocol, fdt_buffer, &size,
+                                        EFI_DT_APPLY_FIXUPS |
+                                        EFI_DT_RESERVE_MEMORY);
                if (EFI_ERROR(status)) {
                        FreePool(fdt_buffer);
-                       error(L"Failed to install alternative device tree",
-                             status);
+                       error(L"Device tree fixup failed", status);
+                       return status;
                }
-               return status;
-       }
-
-       /* Find out which size we need */
-       size = 0;
-       status = protocol->Fixup(protocol, (VOID *) fdt, &size,
-                                EFI_DT_APPLY_FIXUPS);
-       if (status != EFI_BUFFER_TOO_SMALL) {
-               error(L"Device tree fixup: unexpected error", status);
-               return status;
-       }
-
-       fdt_buffer = clone_fdt(fdt, size);
-       if (!fdt_buffer) {
-               return EFI_OUT_OF_RESOURCES;
        }
 
-       status = protocol->Fixup(protocol, fdt_buffer, &size,
-                                EFI_DT_APPLY_FIXUPS | EFI_DT_RESERVE_MEMORY |
-                                EFI_DT_INSTALL_TABLE);
+       status = BS->InstallConfigurationTable(&EfiDtbTableGuid, fdt_buffer);
        if (EFI_ERROR(status)) {
                FreePool(fdt_buffer);
-               error(L"Device tree fixup failed", status);
+               error(L"Failed to install alternative device tree", status);
        }
 
        return status;
-- 
2.35.3

-- 
You received this message because you are subscribed to the Google Groups "EFI 
Boot Guard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/efibootguard-dev/a9e3edf3-b3ea-42e1-f3a9-c951ac29664a%40siemens.com.

Reply via email to