Skip to content

Commit

Permalink
lib/mpi: added comment on divide by 0 case
Browse files Browse the repository at this point in the history
Comment explains that existing clients do not call this function
with dsize == 0, which means that 1/0 should not happen.

Signed-off-by: Dmitry Kasatkin <[email protected]>
Reviewed-by: Tetsuo Handa <[email protected]>
Signed-off-by: James Morris <[email protected]>
  • Loading branch information
Dmitry Kasatkin authored and James Morris committed Feb 1, 2012
1 parent 4877e05 commit a6d68ec
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/mpi/mpih-div.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@ mpihelp_divrem(mpi_ptr_t qp, mpi_size_t qextra_limbs,
case 0:
/* We are asked to divide by zero, so go ahead and do it! (To make
the compiler not remove this statement, return the value.) */
/*
* existing clients of this function have been modified
* not to call it with dsize == 0, so this should not happen
*/
return 1 / dsize;

case 1:
Expand Down

0 comments on commit a6d68ec

Please sign in to comment.