Skip to content

Commit 5cf1c83

Browse files
a3fsaschahauer
authored andcommitted
efi: payload: gracefully handle NULL parent image device path
device_path_to_filepath may be called on a device pth that contains no file path. In that case, the function should return NULL instead of dereferencing the NULL pointer. Fix this. Fixes: f1230c7 ("efi: payload: dynamically determine bootloader file name") Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240611065718.2899625-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
1 parent 47d910f commit 5cf1c83

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

efi/devicepath.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,9 @@ char *device_path_to_filepath(const struct efi_device_path *dev_path)
824824
dev_path = next_device_path_node(&fp->header);
825825
}
826826

827+
if (!fp)
828+
return NULL;
829+
827830
path = strdup_wchar_to_char(fp->path_name);
828831
if (!path)
829832
return NULL;

0 commit comments

Comments
 (0)