[PATCH] efi_loader: fix uninitialized variable bug in efi_set_load_options()

Heinrich Schuchardt xypron.glpk at gmx.de
Thu Jul 27 10:27:07 CEST 2023


On 7/27/23 09:15, Dan Carpenter wrote:
> Check for efi_search_protocol() failure before dereferencing "handler"
> to avoid a crash.
>
> Signed-off-by: Dan Carpenter <dan.carpenter at linaro.org>

Reviewed-by: Heinrich Schuchardt <xypron.glpk at gmx.de>

> ---
>   lib/efi_loader/efi_load_options.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/efi_loader/efi_load_options.c b/lib/efi_loader/efi_load_options.c
> index 3cfddee014e9..5f62184da1cd 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;
>



More information about the U-Boot mailing list