From: Christoph Lameter Date: Thu, 17 May 2007 05:10:53 +0000 (-0700) Subject: slab: warn on zero-length allocations X-Git-Tag: v2.6.22-rc2~58 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b44f7a5b5078d737b3f5914978aabb761254840;p=linux-2.6 slab: warn on zero-length allocations 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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/slab.c b/mm/slab.c index 12344432e2..2043102c04 100644 --- 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++;