aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mpi/mpi-div.c
diff options
context:
space:
mode:
authorDmitry Kasatkin <dmitry.kasatkin@intel.com>2012-01-26 12:13:22 -0500
committerJames Morris <jmorris@namei.org>2012-02-01 08:23:14 -0500
commite2fe85c236736c866481de288f636ab06ef49787 (patch)
tree11861382d9e84ec859a41132afe309f94f7cc20e /lib/mpi/mpi-div.c
parente87c5e35a92e045de75fb6ae9846a38bdd0f92bd (diff)
lib/mpi: checks for zero divisor length
Divisor length should not be 0. Signed-off-by: Dmitry Kasatkin <dmitry.kasatkin@intel.com> Reviewed-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'lib/mpi/mpi-div.c')
-rw-r--r--lib/mpi/mpi-div.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/mpi/mpi-div.c b/lib/mpi/mpi-div.c
index c3087d1390ce..8a45717bd001 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.