Re: [PATCH v2 07/19] rsatoc: cleanup error handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01.08.24 07:57, Sascha Hauer wrote:
> - In case of an error bail out immediately instead of continuing and
>   just return an error at the end
> - explicitly set 'ret' right before going to the cleanup label which
>   makes the code more readable
> 
> Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
> ---
>  scripts/rsatoc.c | 58 +++++++++++++++++++++++++++++++++---------------
>  1 file changed, 40 insertions(+), 18 deletions(-)
> 
> diff --git a/scripts/rsatoc.c b/scripts/rsatoc.c
> index 0faf41bca2..22f0318298 100644
> --- a/scripts/rsatoc.c
> +++ b/scripts/rsatoc.c
> @@ -167,15 +167,16 @@ static int rsa_get_exponent(RSA *key, uint64_t *e)
>  	const BIGNUM *key_e;
>  	uint64_t te;
>  
> -	ret = -EINVAL;
>  	bn_te = NULL;
>  
>  	if (!e)
>  		goto cleanup;

Won't ret be undefined here?

Also the return value is ultimately used only for an error message,
gen_key's error is not propagated, but it should result in the utility
aborting with an error code.

Cheers,
Ahmad

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux