Skip to content

Commit

Permalink
lib/mpi: check for possible zero length
Browse files Browse the repository at this point in the history
Buggy client might pass zero nlimbs which is meaningless.
Added check for zero length.

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 b35e286 commit 4877e05
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/mpi/mpiutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ mpi_ptr_t mpi_alloc_limb_space(unsigned nlimbs)
{
size_t len = nlimbs * sizeof(mpi_limb_t);

if (!len)
return NULL;

return kmalloc(len, GFP_KERNEL);
}

Expand Down

0 comments on commit 4877e05

Please sign in to comment.