aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mpi/mpi-div.c
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2012-02-22 22:04:41 +0000
committerRussell King <rmk+kernel@arm.linux.org.uk>2012-02-22 22:04:41 +0000
commit61b80086a525c8a6081257ae40da5dee2bcaee16 (patch)
tree675da35e4c03be3a5ca17bf6430e5b51dfed6296 /lib/mpi/mpi-div.c
parentMerge tag 'v3.3-rc2' into depends/rmk/for-armsoc (diff)
parentARM: remove disable_fiq and arch_ret_to_user macros (diff)
downloadlinux-dev-61b80086a525c8a6081257ae40da5dee2bcaee16.tar.xz
linux-dev-61b80086a525c8a6081257ae40da5dee2bcaee16.zip
Merge branch 'entry-macro-cleanup' of git://sources.calxeda.com/kernel/linux into for-armsoc
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. */