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:
parent
3cccd1543a
commit
e87c5e35a9
@ -59,7 +59,7 @@ int mpi_powm(MPI res, MPI base, MPI exp, MPI mod)
|
|||||||
ep = exp->d;
|
ep = exp->d;
|
||||||
|
|
||||||
if (!msize)
|
if (!msize)
|
||||||
msize = 1 / msize; /* provoke a signal */
|
return -EINVAL;
|
||||||
|
|
||||||
if (!esize) {
|
if (!esize) {
|
||||||
/* Exponent is zero, result is 1 mod MOD, i.e., 1 or 0
|
/* Exponent is zero, result is 1 mod MOD, i.e., 1 or 0
|
||||||
|
Loading…
Reference in New Issue
Block a user