[PATCH master 3/4] efi: payload: gracefully handle NULL parent image device path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: f1230c7f92cd ("efi: payload: dynamically determine bootloader file name")
Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 efi/devicepath.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/efi/devicepath.c b/efi/devicepath.c
index 23963aa0cbb7..ecb3e7b64cc1 100644
--- a/efi/devicepath.c
+++ b/efi/devicepath.c
@@ -824,6 +824,9 @@ char *device_path_to_filepath(const struct efi_device_path *dev_path)
 		dev_path = next_device_path_node(&fp->header);
 	}
 
+	if (!fp)
+		return NULL;
+
 	path = strdup_wchar_to_char(fp->path_name);
 	if (!path)
 		return NULL;
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux