aboutsummaryrefslogtreecommitdiff
path: root/lib/efi_loader
diff options
context:
space:
mode:
authorRob Clark2017-08-06 14:10:07 -0400
committerAlexander Graf2017-08-11 11:08:33 +0200
commit796a78cbe5676fc7562b50c7a0191fa56c8c4772 (patch)
tree12490cb2543ff1b5fea91179110d7d67a148fdaa /lib/efi_loader
parentebf199b92f81d4c1228200bfc138aa32928bf373 (diff)
efi_loader: LocateHandle should return EFI_NOT_FOUND if none found
Spotted this debugging OpenBSD's bootloader in qemu. (Wouldn't really fix anything, the problem was not having any disks, but we should probably return the correct error code.) Signed-off-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'lib/efi_loader')
-rw-r--r--lib/efi_loader/efi_boottime.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 58cd6d0e894..43f32385fae 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -633,6 +633,10 @@ static efi_status_t efi_locate_handle(
return EFI_BUFFER_TOO_SMALL;
}
+ *buffer_size = size;
+ if (size == 0)
+ return EFI_NOT_FOUND;
+
/* Then fill the array */
list_for_each(lhandle, &efi_obj_list) {
struct efi_object *efiobj;
@@ -642,7 +646,6 @@ static efi_status_t efi_locate_handle(
}
}
- *buffer_size = size;
return EFI_SUCCESS;
}