Skip to content

Commit

Permalink
lib/mpi: checks for zero divisor length
Browse files Browse the repository at this point in the history
Divisor length should not be 0.

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 e87c5e3 commit e2fe85c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/mpi/mpi-div.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ int mpi_tdiv_qr(MPI quot, MPI rem, MPI num, MPI den)
mpi_ptr_t marker[5];
int markidx = 0;

if (!dsize)
return -EINVAL;

memset(marker, 0, sizeof(marker));

/* Ensure space is enough for quotient and remainder.
Expand Down

0 comments on commit e2fe85c

Please sign in to comment.