arm/efi: Fix null pointer dereference

Fix for commit 60649d443d
that introduces a null pointer dereference when the
fdt_node_offset_by_compatible is called with "fdt"
argument null.

Reported-by: Julien Grall <julien@xen.org>
Fixes: 60649d443d ("arm/efi: Introduce xen,uefi-cfg-load DT property")
Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
This commit is contained in:
Luca Fancellu authored and Stefano Stabellini committed 2021-10-11 13:19:35 -07:00
1 parent f38c859135
commit 4817dbf1c8
1 file changed
+2 -1
+2 -1
View File
@@ -593,7 +593,8 @@ static bool __init efi_arch_use_config_file(EFI_SYSTEM_TABLE *SystemTable)
dtbfile.ptr = fdt;
dtbfile.need_to_free = false; /* Config table memory can't be freed. */
if ( fdt_node_offset_by_compatible(fdt, 0, "multiboot,module") > 0 )
if ( fdt &&
(fdt_node_offset_by_compatible(fdt, 0, "multiboot,module") > 0) )
{
/* Locate chosen node */
int node = fdt_subnode_offset(fdt, 0, "chosen");
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.