diff mbox series

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

Message ID 20221110082124.210306-1-ilias.apalodimas@linaro.org
State Accepted
Commit 9fb3269ab39d3b3b1db43296b5d2619238eaa8b0
Headers show
Series [v3] efi_loader: initialize return values in efi_uninstall_multiple_protocol_interfaces_int() | expand

Commit Message

Ilias Apalodimas Nov. 10, 2022, 8:21 a.m. UTC
If the va_list we got handed over contains no protocols we must return
EFI_SUCCESS.  However in that case the current code just returns
an unintialized value.
Fix that by setting the return value in the variable definition

Addresses-Coverity: CID 376195:  ("Uninitialized variables  (UNINIT)")
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
---
changes since v2:
- Don't return immediately on NULL protocols.  Instead go through the list of
  already uninstalled protocols and reinstall them
changes since v1:
- return EFI_SUCCESS instead of EFI_INVALID_PARAMETER
 lib/efi_loader/efi_boottime.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Heinrich Schuchardt Nov. 10, 2022, 8:23 a.m. UTC | #1
On 11/10/22 09:21, Ilias Apalodimas wrote:
> If the va_list we got handed over contains no protocols we must return
> EFI_SUCCESS.  However in that case the current code just returns
> an unintialized value.
> Fix that by setting the return value in the variable definition
> 
> Addresses-Coverity: CID 376195:  ("Uninitialized variables  (UNINIT)")
> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> ---
> changes since v2:
> - Don't return immediately on NULL protocols.  Instead go through the list of
>    already uninstalled protocols and reinstall them
> changes since v1:
> - return EFI_SUCCESS instead of EFI_INVALID_PARAMETER
>   lib/efi_loader/efi_boottime.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
> index a56021559bbf..253f9f75ef63 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_SUCCESS;
>   	size_t i = 0;
>   	efi_va_list argptr_copy;
>   

Reviewed by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
diff mbox series

Patch

diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index a56021559bbf..253f9f75ef63 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_SUCCESS;
 	size_t i = 0;
 	efi_va_list argptr_copy;