Message ID | 20200820191117.36849-1-xypron.glpk@gmx.de |
---|---|
State | Accepted |
Commit | de95930946f5de3b5f43aaf4153a334d841d4f3c |
Delegated to: | Tom Rini |
Headers | show |
Series | [1/1] lib/rsa: correct check after allocation in fdt_add_bignum() | expand |
On Thu, 20 Aug 2020 at 13:11, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote: > > After allocating to pointer ctx we should check that pointer and not > another pointer already checked above. > > Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> > --- > lib/rsa/rsa-sign.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Simon Glass <sjg@chromium.org>
On Thu, Aug 20, 2020 at 09:11:17PM +0200, Heinrich Schuchardt wrote: > After allocating to pointer ctx we should check that pointer and not > another pointer already checked above. > > Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> > Reviewed-by: Simon Glass <sjg@chromium.org> Applied to u-boot/master, thanks!
diff --git a/lib/rsa/rsa-sign.c b/lib/rsa/rsa-sign.c index 40ca1e1f57..1f0d81bd7a 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; }
After allocating to pointer ctx we should check that pointer and not another pointer already checked above. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> --- lib/rsa/rsa-sign.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.28.0