summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Kasatkin <dmitry.kasatkin@intel.com>2012-01-26 18:13:21 +0100
committerJames Morris <jmorris@namei.org>2012-02-01 14:23:14 +0100
commite87c5e35a92e045de75fb6ae9846a38bdd0f92bd (patch)
treea518be04415fd6b6746493e96b422bfad1cbb10f
parentlib/mpi: replaced MPI_NULL with normal NULL (diff)
downloadlinux-e87c5e35a92e045de75fb6ae9846a38bdd0f92bd.tar.xz
linux-e87c5e35a92e045de75fb6ae9846a38bdd0f92bd.zip
lib/mpi: return error code on dividing by zero
Definitely better to return error code than to divide by zero. 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>
-rw-r--r--lib/mpi/mpi-pow.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/mpi/mpi-pow.c b/lib/mpi/mpi-pow.c
index b04a3cf80080..67f3e79af914 100644
--- a/lib/mpi/mpi-pow.c
+++ b/lib/mpi/mpi-pow.c
@@ -59,7 +59,7 @@ int mpi_powm(MPI res, MPI base, MPI exp, MPI mod)
ep = exp->d;
if (!msize)
- msize = 1 / msize; /* provoke a signal */
+ return -EINVAL;
if (!esize) {
/* Exponent is zero, result is 1 mod MOD, i.e., 1 or 0