slab: warn on zero-length allocations
authorChristoph Lameter <clameter@sgi.com>
Thu, 17 May 2007 05:10:53 +0000 (22:10 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 17 May 2007 12:23:03 +0000 (05:23 -0700)
slub warns on this, and we're working on making kmalloc(0) return NULL.
Let's make slab warn as well so our testers detect such callers more
rapidly.

Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/slab.c

index 12344432e201f0e4267a6541dd48f24724ff222d..2043102c0425ecb711f994c9e201e5765c11ab2b 100644 (file)
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -789,6 +789,7 @@ static inline struct kmem_cache *__find_general_cachep(size_t size,
         */
        BUG_ON(malloc_sizes[INDEX_AC].cs_cachep == NULL);
 #endif
+       WARN_ON_ONCE(size == 0);
        while (size > csizep->cs_size)
                csizep++;