From: Dmitry Kasatkin Date: Thu, 26 Jan 2012 17:13:21 +0000 (+0200) Subject: lib/mpi: return error code on dividing by zero X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=e87c5e35a92e045de75fb6ae9846a38bdd0f92bd;p=linux-beck.git 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 Reviewed-by: Tetsuo Handa Signed-off-by: James Morris --- 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