Skip to contentSkip to conversation

lib/rsa: correct check after allocation in fdt_add_bignum()

PATCH New Heinrich Schuchardt 3 participants 3 messages Aug 20, 2020 – Aug 28, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 lib/rsa/rsa-sign.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/rsa/rsa-sign.c +1 -1
index 40ca1e1f57..1f0d81bd7a 100644
@@ -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;
 	}

--
2.28.0

#2 lore raw

PATCH 1/1 lib/rsa: correct check after allocation in fdt_add_bignum()

In reply to Heinrich Schuchardt
Quoted 5 lines · Heinrich Schuchardt

After allocating to pointer ctx we should check that pointer and not another pointer already checked above.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200828/e789e151/attachment.sig>