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>
This commit is contained in:
Dmitry Kasatkin 2012-01-26 19:13:21 +02:00 committed by James Morris
parent 3cccd1543a
commit e87c5e35a9

View File

@ -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