diff options
author | Ingo Molnar <mingo@elte.hu> | 2012-02-07 04:00:06 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2012-02-07 04:00:41 -0500 |
commit | 52fce956a7568504a1da90c14b9bf2deaad401bd (patch) | |
tree | 5f9ed93cbdfa8f8356fc0daea8fa2da07eeae7bd /lib/mpi/mpi-div.c | |
parent | 290436c9c61ac983b1bd425da67242a4357c7701 (diff) | |
parent | 9dac6a29e0ce0cd9dec497baa123e216b00b525d (diff) |
Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
perf/core fixes and improvements.
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 c3087d1390c..f68cbbb4d4a 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) | |||
149 | mpi_ptr_t marker[5]; | 149 | mpi_ptr_t marker[5]; |
150 | int markidx = 0; | 150 | int markidx = 0; |
151 | 151 | ||
152 | if (!dsize) | ||
153 | return -EINVAL; | ||
154 | |||
152 | memset(marker, 0, sizeof(marker)); | 155 | memset(marker, 0, sizeof(marker)); |
153 | 156 | ||
154 | /* Ensure space is enough for quotient and remainder. | 157 | /* Ensure space is enough for quotient and remainder. |
@@ -207,6 +210,8 @@ int mpi_tdiv_qr(MPI quot, MPI rem, MPI num, MPI den) | |||
207 | * numerator would be gradually overwritten by the quotient limbs. */ | 210 | * numerator would be gradually overwritten by the quotient limbs. */ |
208 | if (qp == np) { /* Copy NP object to temporary space. */ | 211 | if (qp == np) { /* Copy NP object to temporary space. */ |
209 | np = marker[markidx++] = mpi_alloc_limb_space(nsize); | 212 | np = marker[markidx++] = mpi_alloc_limb_space(nsize); |
213 | if (!np) | ||
214 | goto nomem; | ||
210 | MPN_COPY(np, qp, nsize); | 215 | MPN_COPY(np, qp, nsize); |
211 | } | 216 | } |
212 | } else /* Put quotient at top of remainder. */ | 217 | } else /* Put quotient at top of remainder. */ |