diff options
author | Ingo Molnar <mingo@elte.hu> | 2012-02-07 14:33:48 +0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2012-02-07 14:33:51 +0400 |
commit | 7915a2e902df9fdb5ea5d5786a4172b38d0ea71e (patch) | |
tree | 72b67d3079ffad2f5e21a5a449d210b355da13b6 /lib/mpi/mpi-div.c | |
parent | 35f1790e6c6a7e4cae57b616cf36444d27fa6b28 (diff) | |
parent | 23783f817bceedd6d4e549385e3f400ea64059e5 (diff) | |
download | linux-7915a2e902df9fdb5ea5d5786a4172b38d0ea71e.tar.xz |
Merge branch 'linus' into x86/boot
Merge this into x86/boot so that we can queue up dependent patches.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
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 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. */ |