[PATCH 1/1] lib: rsa: remove redundant check

Heinrich Schuchardt xypron.glpk at gmx.de
Thu Aug 20 21:05:06 CEST 2020


On 8/20/20 8:30 PM, George McCollister wrote:
> On Thu, Aug 20, 2020 at 1:25 PM Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>>
>> No need to check tmp is non-zero twice.
>>
>> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
>> ---
>>  lib/rsa/rsa-sign.c | 4 ----
>>  1 file changed, 4 deletions(-)
>>
>> diff --git a/lib/rsa/rsa-sign.c b/lib/rsa/rsa-sign.c
>> index 40ca1e1f57..18b68e1976 100644
>> --- a/lib/rsa/rsa-sign.c
>> +++ b/lib/rsa/rsa-sign.c
>> @@ -708,10 +708,6 @@ static int fdt_add_bignum(void *blob, int noffset, const char *prop_name,
>>                 return -ENOMEM;
>>         }
>>         ctx = BN_CTX_new();
>
> The intention was probably to check ctx. Maybe a copy and paste error?

Makes sense:

"BN_CTX_new() returns a pointer to the BN_CTX. If the allocation fails,
it returns NULL and sets an error code that can be obtained by
ERR_get_error(3)."

Best regards

Heinrich

>
>> -       if (!tmp) {
>> -               fprintf(stderr, "Out of memory (bignum context)\n");
>> -               return -ENOMEM;
>> -       }
>>         BN_set_word(big2, 2L);
>>         BN_set_word(big32, 32L);
>>         BN_exp(big2_32, big2, big32, ctx); /* B = 2^32 */
>> --
>> 2.28.0
>>



More information about the U-Boot mailing list