From: Christoph Lameter Date: Thu, 17 May 2007 05:10:53 +0000 (-0700) Subject: slab: warn on zero-length allocations X-Git-Tag: firefly_0821_release~29092 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=0b44f7a5b5078d737b3f5914978aabb761254840;p=firefly-linux-kernel-4.4.55.git 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 12344432e201..2043102c0425 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++;