diff options
author | Dmitry Kasatkin <dmitry.kasatkin@intel.com> | 2012-01-26 12:13:19 -0500 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2012-02-01 08:23:39 -0500 |
commit | 4877e056192245b387aae004ab38f7f3899dd57c (patch) | |
tree | af540cd2de9df321421651016fed50e4a56b224c /lib | |
parent | b35e286a640f31d619a637332972498b51f3fd90 (diff) |
lib/mpi: check for possible zero length
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>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mpi/mpiutil.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/mpi/mpiutil.c b/lib/mpi/mpiutil.c index 6bfc41f62b8f..26e4ed31e256 100644 --- a/lib/mpi/mpiutil.c +++ b/lib/mpi/mpiutil.c | |||
@@ -58,6 +58,9 @@ mpi_ptr_t mpi_alloc_limb_space(unsigned nlimbs) | |||
58 | { | 58 | { |
59 | size_t len = nlimbs * sizeof(mpi_limb_t); | 59 | size_t len = nlimbs * sizeof(mpi_limb_t); |
60 | 60 | ||
61 | if (!len) | ||
62 | return NULL; | ||
63 | |||
61 | return kmalloc(len, GFP_KERNEL); | 64 | return kmalloc(len, GFP_KERNEL); |
62 | } | 65 | } |
63 | 66 | ||