summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2020-07-07 05:21:26 +0300
committerHeinrich Schuchardt <xypron.glpk@gmx.de>2020-07-12 00:14:16 +0300
commit1047c6e23c9bf7e2e0b0c0539b6d7289627c9f71 (patch)
tree30de3bcb509ff55413bcadef841be4e16d5c7e58 /lib
parent39a75f5af139eaa53758a8cb0e0788cfafdaf54c (diff)
downloadu-boot-1047c6e23c9bf7e2e0b0c0539b6d7289627c9f71.tar.xz
efi_loader: fix efi_get_child_controllers()
Don't call calloc(0, ..). Consider return value of efi_get_child_controllers(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/efi_loader/efi_boottime.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 1591ad8300..0b16554ba2 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -3459,6 +3459,8 @@ static efi_status_t efi_get_child_controllers(
* the buffer will be too large. But that does not harm.
*/
*number_of_children = 0;
+ if (!count)
+ return EFI_SUCCESS;
*child_handle_buffer = calloc(count, sizeof(efi_handle_t));
if (!*child_handle_buffer)
return EFI_OUT_OF_RESOURCES;
@@ -3536,10 +3538,12 @@ static efi_status_t EFIAPI efi_disconnect_controller(
number_of_children = 1;
child_handle_buffer = &child_handle;
} else {
- efi_get_child_controllers(efiobj,
- driver_image_handle,
- &number_of_children,
- &child_handle_buffer);
+ r = efi_get_child_controllers(efiobj,
+ driver_image_handle,
+ &number_of_children,
+ &child_handle_buffer);
+ if (r != EFI_SUCCESS)
+ return r;
}
/* Get the driver binding protocol */