[PATCH] efi_loader: initialize return values in efi_uninstall_multiple_protocol_interfaces_int()

Heinrich Schuchardt xypron.glpk at gmx.de
Thu Nov 10 09:11:59 CET 2022


On 11/10/22 08:35, Ilias Apalodimas wrote:
> If the va_list we got handed over contains no protocols we must return
> EFI_INVALID_PARAMETER.  However in that case the current code just returns
> an unintialized value.
>
> Addresses-Coverity: CID 376195:  ("Uninitialized variables  (UNINIT)")
> ---
>   lib/efi_loader/efi_boottime.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
> index a56021559bbf..96aa36ef85de 100644
> --- a/lib/efi_loader/efi_boottime.c
> +++ b/lib/efi_loader/efi_boottime.c
> @@ -2754,7 +2754,7 @@ efi_uninstall_multiple_protocol_interfaces_int(efi_handle_t handle,
>   {
>   	const efi_guid_t *protocol;
>   	void *protocol_interface;
> -	efi_status_t ret;
> +	efi_status_t ret = EFI_INVALID_PARAMETER;

This should be EFI_SUCCESS as the UEFI spec does not explicitly forbid
to call the function without any protocol. EDK II does the same.

Best regards

Heinrich

>   	size_t i = 0;
>   	efi_va_list argptr_copy;
>
> @@ -2765,7 +2765,7 @@ efi_uninstall_multiple_protocol_interfaces_int(efi_handle_t handle,
>   	for (;;) {
>   		protocol = efi_va_arg(argptr, efi_guid_t*);
>   		if (!protocol)
> -			break;
> +			goto out;
>   		protocol_interface = efi_va_arg(argptr, void*);
>   		ret = efi_uninstall_protocol(handle, protocol,
>   					     protocol_interface);



More information about the U-Boot mailing list