diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2012-02-28 13:48:58 -0600 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2012-02-28 13:48:58 -0600 |
commit | b3950d50cfc343b3e7dc5c69c96a61b182fd1e37 (patch) | |
tree | d54affae2b1e25464493b48aa88cd8d6b4770812 /lib/mpi/mpi-div.c | |
parent | daefd89efc279b142bbb054577c2d706da211723 (diff) | |
parent | 280ad7fda5f95211857fda38960f2b6fdf6edd3e (diff) | |
download | op-kernel-dev-b3950d50cfc343b3e7dc5c69c96a61b182fd1e37.zip op-kernel-dev-b3950d50cfc343b3e7dc5c69c96a61b182fd1e37.tar.gz |
Merge branch 'irqdomain/next' into gpio/next
Diffstat (limited to 'lib/mpi/mpi-div.c')
-rw-r--r-- | lib/mpi/mpi-div.c | 5 |
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. */ |