summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@linaro.org>2023-07-27 10:15:01 +0300
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2023-07-28 11:36:37 +0200
commita7eb8aeccb8a6a574c8c8bac22c8e61ec425fea1 (patch)
tree0f4cabc6ae464ca26394a58931bb2b81040c1d33
parentf687c8f7b44624a058b1a3979acea7f37f301c74 (diff)
downloadu-boot-a7eb8aeccb8a6a574c8c8bac22c8e61ec425fea1.tar.gz
u-boot-a7eb8aeccb8a6a574c8c8bac22c8e61ec425fea1.tar.bz2
u-boot-a7eb8aeccb8a6a574c8c8bac22c8e61ec425fea1.zip
efi_loader: fix uninitialized variable bug in efi_set_load_options()
Check for efi_search_protocol() failure before dereferencing "handler" to avoid a crash. Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
-rw-r--r--lib/efi_loader/efi_load_options.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/efi_loader/efi_load_options.c b/lib/efi_loader/efi_load_options.c
index 3cfddee014..5f62184da1 100644
--- a/lib/efi_loader/efi_load_options.c
+++ b/lib/efi_loader/efi_load_options.c
@@ -31,10 +31,10 @@ efi_status_t efi_set_load_options(efi_handle_t handle,
efi_status_t ret;
ret = efi_search_protocol(handle, &efi_guid_loaded_image, &handler);
- loaded_image_info = handler->protocol_interface;
if (ret != EFI_SUCCESS)
return EFI_INVALID_PARAMETER;
+ loaded_image_info = handler->protocol_interface;
loaded_image_info->load_options = load_options;
loaded_image_info->load_options_size = load_options_size;