From 5204355861643a658a6d8e009b67e422cdb9194b Mon Sep 17 00:00:00 2001 From: ksa678491784 Date: Tue, 28 Dec 2021 18:09:33 +0300 Subject: [PATCH] stub: Do not assume having DeviceHandle --- src/boot/efi/cpio.c | 6 ++++++ src/boot/efi/disk.c | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/boot/efi/cpio.c b/src/boot/efi/cpio.c index be0708aec4..74610cc1c7 100644 --- a/src/boot/efi/cpio.c +++ b/src/boot/efi/cpio.c @@ -330,6 +330,12 @@ EFI_STATUS pack_cpio( assert(ret_buffer); assert(ret_buffer_size); + if (!loaded_image->DeviceHandle) { + *ret_buffer = NULL; + *ret_buffer_size = 0; + return EFI_SUCCESS; + } + root = LibOpenRoot(loaded_image->DeviceHandle); if (!root) return log_error_status_stall(EFI_LOAD_ERROR, L"Unable to open root directory."); diff --git a/src/boot/efi/disk.c b/src/boot/efi/disk.c index 6d3c8285a1..b7beac3d08 100644 --- a/src/boot/efi/disk.c +++ b/src/boot/efi/disk.c @@ -10,7 +10,8 @@ EFI_STATUS disk_get_part_uuid(EFI_HANDLE *handle, CHAR16 uuid[static 37]) { EFI_DEVICE_PATH *device_path; _cleanup_freepool_ EFI_DEVICE_PATH *paths = NULL; - assert(handle); + if (!handle) + return EFI_NOT_FOUND; /* export the device path this image is started from */ device_path = DevicePathFromHandle(handle); -- 2.25.1