]> Pileus Git - ~andy/linux/blobdiff - lib/mpi/mpiutil.c
lib/mpi: check for possible zero length
[~andy/linux] / lib / mpi / mpiutil.c
index 6bfc41f62b8f45b14bd0d89581297df607ad7595..26e4ed31e256f793d4bdc21ea81f7f6a8ca4bf71 100644 (file)
@@ -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);
 }