barebox' EFI loaded image handle should have a device path, but on the off-case that it doesn't, we should just return an error code instead of dereferencing a null pointer. Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> --- efi/payload/init.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/efi/payload/init.c b/efi/payload/init.c index 354120b11a86..b312866cb1f6 100644 --- a/efi/payload/init.c +++ b/efi/payload/init.c @@ -327,6 +327,9 @@ static int efi_postcore_init(void) loaded_image_dp = device_path_from_handle(efi_loaded_image->device_handle); pr_debug("loaded-image: %pD\n", loaded_image_dp); + if (!loaded_image_dp) + return -EINVAL; + uuid = device_path_to_partuuid(loaded_image_dp); if (uuid) { wchar_t *uuid16 = xstrdup_char_to_wchar(uuid); -- 2.39.2