From: Heinrich Schuchardt Date: Thu, 20 Aug 2020 19:11:17 +0000 (+0200) Subject: lib/rsa: correct check after allocation in fdt_add_bignum() X-Git-Tag: v2020.10~41^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=de95930946f5de3b5f43aaf4153a334d841d4f3c;p=platform%2Fkernel%2Fu-boot.git lib/rsa: correct check after allocation in fdt_add_bignum() After allocating to pointer ctx we should check that pointer and not another pointer already checked above. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- diff --git a/lib/rsa/rsa-sign.c b/lib/rsa/rsa-sign.c index 40ca1e1..1f0d81b 100644 --- a/lib/rsa/rsa-sign.c +++ b/lib/rsa/rsa-sign.c @@ -708,7 +708,7 @@ static int fdt_add_bignum(void *blob, int noffset, const char *prop_name, return -ENOMEM; } ctx = BN_CTX_new(); - if (!tmp) { + if (!ctx) { fprintf(stderr, "Out of memory (bignum context)\n"); return -ENOMEM; }