]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
stub: Do not assume having DeviceHandle
authorksa678491784 <ksa678491784@gmail.com>
Tue, 28 Dec 2021 15:09:33 +0000 (18:09 +0300)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 29 Dec 2021 02:59:57 +0000 (11:59 +0900)
src/boot/efi/cpio.c
src/boot/efi/disk.c

index be0708aec43dd70b4d5653c3d728bf6c7c6c4bd6..74610cc1c7f3b16bf2a0d3555c618a6c4a6059d6 100644 (file)
@@ -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.");
index 6d3c8285a15b56648f5eb3000389825c6c703e5b..b7beac3d08b9683b2b230c3bdbbc748c7c7b8f6b 100644 (file)
@@ -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);