summaryrefslogtreecommitdiff
path: root/lib/mpi/mpi-div.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-03-09 20:35:53 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-03-09 20:35:53 (GMT)
commit263a5c8e16c34199ddf6de3f102e789ffa3ee26e (patch)
tree4f049e339d522b2ab0ba3bed3ec217e4bbc83d35 /lib/mpi/mpi-div.c
parent54d20f006ceff1f2f1e69d0e54049b6c0765c039 (diff)
parent192cfd58774b4d17b2fe8bdc77d89c2ef4e0591d (diff)
downloadlinux-263a5c8e16c34199ddf6de3f102e789ffa3ee26e.tar.xz
Merge 3.3-rc6 into driver-core-next
This was done to resolve a conflict in the drivers/base/cpu.c file. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'lib/mpi/mpi-div.c')
-rw-r--r--lib/mpi/mpi-div.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/mpi/mpi-div.c b/lib/mpi/mpi-div.c
index c3087d1..f68cbbb 100644
--- a/lib/mpi/mpi-div.c
+++ b/lib/mpi/mpi-div.c
@@ -149,6 +149,9 @@ int mpi_tdiv_qr(MPI quot, MPI rem, MPI num, MPI den)
mpi_ptr_t marker[5];
int markidx = 0;
+ if (!dsize)
+ return -EINVAL;
+
memset(marker, 0, sizeof(marker));
/* Ensure space is enough for quotient and remainder.
@@ -207,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. */