diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2011-12-07 12:58:26 +0100 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2011-12-07 14:09:23 +0100 |
commit | fe0e94c5a7e5335ba0d200e7d3e26e9f80cda4b1 (patch) | |
tree | e11c25e3cecf762931eba576c50a12372039c412 /lib | |
parent | digsig: build dependency fix (diff) | |
download | linux-fe0e94c5a7e5335ba0d200e7d3e26e9f80cda4b1.tar.xz linux-fe0e94c5a7e5335ba0d200e7d3e26e9f80cda4b1.zip |
mpi/mpi-mpow: NULL dereference on allocation failure
We can't call mpi_free() on the elements if the first kzalloc() fails.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Dmitry Kasatkin <dmitry.kasatkin@intel.com>
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mpi/mpi-mpow.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/mpi/mpi-mpow.c b/lib/mpi/mpi-mpow.c index 4cc75933c5a7..7328d0d6c748 100644 --- a/lib/mpi/mpi-mpow.c +++ b/lib/mpi/mpi-mpow.c @@ -73,7 +73,7 @@ int mpi_mulpowm(MPI res, MPI *basearray, MPI *exparray, MPI m) G = kzalloc((1 << k) * sizeof *G, GFP_KERNEL); if (!G) - goto nomem; + goto err_out; /* and calculate */ tmp = mpi_alloc(mpi_get_nlimbs(m) + 1); @@ -129,5 +129,6 @@ nomem: for (i = 0; i < (1 << k); i++) mpi_free(G[i]); kfree(G); +err_out: return rc; } |