]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
efi_loader: fix uninitialized variable bug in efi_set_load_options()
authorDan Carpenter <dan.carpenter@linaro.org>
Thu, 27 Jul 2023 07:15:01 +0000 (10:15 +0300)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Fri, 28 Jul 2023 09:36:37 +0000 (11:36 +0200)
Check for efi_search_protocol() failure before dereferencing "handler"
to avoid a crash.

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
lib/efi_loader/efi_load_options.c

index 3cfddee014e9a51f71703aaaa4ac9b21ebd58874..5f62184da1cd5d9e11b77a8886f6ce4b4acb1598 100644 (file)
@@ -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;