diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/efi_loader/efi_device_path.c | 7 | ||||
-rw-r--r-- | lib/efi_selftest/efi_selftest_register_notify.c | 16 |
2 files changed, 17 insertions, 6 deletions
diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c index 71923b1127..04ebb449ca 100644 --- a/lib/efi_loader/efi_device_path.c +++ b/lib/efi_loader/efi_device_path.c @@ -843,12 +843,17 @@ static unsigned dp_part_size(struct blk_desc *desc, int part) * @buf buffer to which the device path is written * @desc block device descriptor * @part partition number, 0 identifies a block device + * + * Return: pointer to position after the node */ static void *dp_part_node(void *buf, struct blk_desc *desc, int part) { struct disk_partition info; + int ret; - part_get_info(desc, part, &info); + ret = part_get_info(desc, part, &info); + if (ret < 0) + return buf; if (desc->part_type == PART_TYPE_ISO) { struct efi_device_path_cdrom_path *cddp = buf; diff --git a/lib/efi_selftest/efi_selftest_register_notify.c b/lib/efi_selftest/efi_selftest_register_notify.c index ad763dd6cb..ad4bcce1a1 100644 --- a/lib/efi_selftest/efi_selftest_register_notify.c +++ b/lib/efi_selftest/efi_selftest_register_notify.c @@ -24,6 +24,7 @@ struct context { efi_uintn_t notify_count; efi_uintn_t handle_count; efi_handle_t *handles; + efi_status_t ret; }; static struct efi_boot_services *boottime; @@ -46,17 +47,18 @@ static struct efi_event *event; static void EFIAPI notify(struct efi_event *event, void *context) { struct context *cp = context; - efi_status_t ret; efi_uintn_t handle_count; efi_handle_t *handles; cp->notify_count++; for (;;) { - ret = boottime->locate_handle_buffer(BY_REGISTER_NOTIFY, NULL, - cp->registration_key, - &handle_count, &handles); - if (ret != EFI_SUCCESS) + cp->ret = boottime->locate_handle_buffer(BY_REGISTER_NOTIFY, + NULL, + cp->registration_key, + &handle_count, + &handles); + if (cp->ret != EFI_SUCCESS) break; cp->handle_count += handle_count; cp->handles = handles; @@ -204,6 +206,10 @@ static int execute(void) efi_st_error("LocateHandle failed\n"); return EFI_ST_FAILURE; } + if (context.ret != EFI_NOT_FOUND) { + efi_st_error("LocateHandle did not return EFI_NOT_FOUND\n"); + return EFI_ST_FAILURE; + } ret = boottime->free_pool(context.handles); if (ret != EFI_SUCCESS) { efi_st_error("FreePool failed\n"); |