summaryrefslogtreecommitdiff
path: root/lib/mpi/mpi-div.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2012-02-27 13:40:41 +0000
committerArnd Bergmann <arnd@arndb.de>2012-02-27 13:40:49 +0000
commit96a3eab338c01e172745b1686c51c1be96ce9ead (patch)
tree5a53947a192549d9edf63550258e1bddf6f1d794 /lib/mpi/mpi-div.c
parentb01ee53dda8bd81855b7cda0dfb7f27d1524d87f (diff)
parenta5a928c51f807262a13e6e3412e0e1324f6b7aeb (diff)
downloadlinux-96a3eab338c01e172745b1686c51c1be96ce9ead.tar.gz
linux-96a3eab338c01e172745b1686c51c1be96ce9ead.tar.bz2
linux-96a3eab338c01e172745b1686c51c1be96ce9ead.zip
Merge branch 'imx-cleanup' of git://git.pengutronix.de/git/imx/linux-2.6 into next/cleanup
* 'imx-cleanup' of git://git.pengutronix.de/git/imx/linux-2.6: (247 commits) ARM: Remove redundant ';' from avic_irq_set_priority() ARM: mx3: Let mx31 and mx35 share the same CCM header file ARM: plat-mxc: audmux-v1: Remove unneeded ifdef's Update to v3.3-rc3 Signed-off-by: Arnd Bergmann <arnd@arndb.de>
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 c3087d1390ce..f68cbbb4d4a4 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. */