summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Kasatkin <dmitry.kasatkin@intel.com>2012-01-26 18:13:18 +0100
committerJames Morris <jmorris@namei.org>2012-02-01 14:23:39 +0100
commit43b2c0aeaab2237996a72f9b9d7952ba82d56913 (patch)
treed685ff8357eafe11ffab7d42bf4e7d3fd81cb97c
parentlib/mpi: added comment on divide by 0 case (diff)
downloadlinux-43b2c0aeaab2237996a72f9b9d7952ba82d56913.tar.xz
linux-43b2c0aeaab2237996a72f9b9d7952ba82d56913.zip
lib/mpi: added missing NULL check
Added missing NULL check after mpi_alloc_limb_space(). Signed-off-by: Dmitry Kasatkin <dmitry.kasatkin@intel.com> Reviewed-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Signed-off-by: James Morris <jmorris@namei.org>
-rw-r--r--lib/mpi/mpi-div.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/mpi/mpi-div.c b/lib/mpi/mpi-div.c
index 8a45717bd001..f68cbbb4d4a4 100644
--- a/lib/mpi/mpi-div.c
+++ b/lib/mpi/mpi-div.c
@@ -210,6 +210,8 @@ int mpi_tdiv_qr(MPI quot, MPI rem, MPI num, MPI den)
* numerator would be gradually overwritten by the quotient limbs. */
if (qp == np) { /* Copy NP object to temporary space. */
np = marker[markidx++] = mpi_alloc_limb_space(nsize);
+ if (!np)
+ goto nomem;
MPN_COPY(np, qp, nsize);
}
} else /* Put quotient at top of remainder. */