diff mbox series

efi_loader: variable: fix an reachable statement

Message ID 20200508055101.7505-1-takahiro.akashi@linaro.org
State New
Headers show
Series efi_loader: variable: fix an reachable statement | expand

Commit Message

AKASHI Takahiro May 8, 2020, 5:51 a.m. UTC
The code should jump into error recovery instead of just returning
an error.

Signed-off-by: AKASHI Takahiro <takahiro.akashi at linaro.org>
Reported-by: Coverity (CID 300332)
---
 lib/efi_loader/efi_variable.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Heinrich Schuchardt May 8, 2020, 2:15 p.m. UTC | #1
On 08.05.20 07:51, AKASHI Takahiro wrote:
> The code should jump into error recovery instead of just returning
> an error.
>
> Signed-off-by: AKASHI Takahiro <takahiro.akashi at linaro.org>
> Reported-by: Coverity (CID 300332)

I already a patch with the same change:
[PATCH 1/1] efi_loader: error handling in efi_set_variable_common()
https://lists.denx.de/pipermail/u-boot/2020-May/410590.html

Best regards

Heinrich

> ---
>  lib/efi_loader/efi_variable.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c
> index 5b86b77c6660..f40b194b13bf 100644
> --- a/lib/efi_loader/efi_variable.c
> +++ b/lib/efi_loader/efi_variable.c
> @@ -1094,7 +1094,7 @@ efi_status_t EFIAPI efi_set_variable_common(u16 *variable_name,
>  	if (append) {
>  		old_data = malloc(old_size);
>  		if (!old_data) {
> -			return EFI_OUT_OF_RESOURCES;
> +			ret = EFI_OUT_OF_RESOURCES;
>  			goto err;
>  		}
>  		ret = EFI_CALL(efi_get_variable(variable_name, vendor,
>
diff mbox series

Patch

diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c
index 5b86b77c6660..f40b194b13bf 100644
--- a/lib/efi_loader/efi_variable.c
+++ b/lib/efi_loader/efi_variable.c
@@ -1094,7 +1094,7 @@  efi_status_t EFIAPI efi_set_variable_common(u16 *variable_name,
 	if (append) {
 		old_data = malloc(old_size);
 		if (!old_data) {
-			return EFI_OUT_OF_RESOURCES;
+			ret = EFI_OUT_OF_RESOURCES;
 			goto err;
 		}
 		ret = EFI_CALL(efi_get_variable(variable_name, vendor,