diff options
author | Dmitry Kasatkin <dmitry.kasatkin@intel.com> | 2012-01-26 18:13:22 +0100 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2012-02-01 14:23:14 +0100 |
commit | e2fe85c236736c866481de288f636ab06ef49787 (patch) | |
tree | 11861382d9e84ec859a41132afe309f94f7cc20e /lib/mpi | |
parent | lib/mpi: return error code on dividing by zero (diff) | |
download | linux-e2fe85c236736c866481de288f636ab06ef49787.tar.xz linux-e2fe85c236736c866481de288f636ab06ef49787.zip |
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')
-rw-r--r-- | lib/mpi/mpi-div.c | 3 |
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) 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. |