aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2023-06-01 09:06:09 +0200
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2023-06-02 10:59:15 +0200
commit75ebeb4d94bd911ee7884b7beae06f3dec2838a8 (patch)
treea048fa8cae729388804f9076d57a99bff17a643d
parent1becdfcdc1eefecc061e34d7cc4eb92b403c5c4e (diff)
downloadu-boot-75ebeb4d94bd911ee7884b7beae06f3dec2838a8.zip
u-boot-75ebeb4d94bd911ee7884b7beae06f3dec2838a8.tar.gz
u-boot-75ebeb4d94bd911ee7884b7beae06f3dec2838a8.tar.bz2
efi_selftest: LocateHandleBuffer return code
Check that LocateHandleBuffer() return EFI_NOT_FOUND when called with ByRegisterNotify and all handles already have been retrieved. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
-rw-r--r--lib/efi_selftest/efi_selftest_register_notify.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/efi_selftest/efi_selftest_register_notify.c b/lib/efi_selftest/efi_selftest_register_notify.c
index ad763dd..ad4bcce 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");