Skip to content

Commit

Permalink
lib/mpi: return error code on dividing by zero
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dmitry Kasatkin authored and James Morris committed Feb 1, 2012
1 parent 3cccd15 commit e87c5e3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/mpi/mpi-pow.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e87c5e3

Please sign in to comment.