Skip to content

Commit 668a84c

Browse files
changbinduardbiesheuvel
authored andcommitted
efi/fdt: fix panic when no valid fdt found
setup_arch() would invoke efi_init()->efi_get_fdt_params(). If no valid fdt found then initial_boot_params will be null. So we should stop further fdt processing here. I encountered this issue on risc-v. Signed-off-by: Changbin Du <changbin.du@gmail.com> Fixes: b91540d ("RISC-V: Add EFI runtime services") Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
1 parent 6efb943 commit 668a84c

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎drivers/firmware/efi/fdtparams.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ u64 __init efi_get_fdt_params(struct efi_memory_map_data *mm)
9898
BUILD_BUG_ON(ARRAY_SIZE(target) != ARRAY_SIZE(name));
9999
BUILD_BUG_ON(ARRAY_SIZE(target) != ARRAY_SIZE(dt_params[0].params));
100100

101+
if (!fdt)
102+
return 0;
103+
101104
for (i = 0; i < ARRAY_SIZE(dt_params); i++) {
102105
node = fdt_path_offset(fdt, dt_params[i].path);
103106
if (node < 0)

0 commit comments

Comments
 (0)