From: Pekka Enberg Date: Thu, 22 May 2008 16:22:25 +0000 (+0300) Subject: slub: ksize() abuse checks X-Git-Tag: v2.6.26-rc4~4^2 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=76994412f8e824e79a593d6777ec327d85f942b2;p=linux-2.6 slub: ksize() abuse checks Add a WARN_ON for pages that don't have PageSlab nor PageCompound set to catch the worst abusers of ksize() in the kernel. Acked-by: Christoph Lameter Cc: Matt Mackall Signed-off-by: Pekka Enberg --- diff --git a/mm/slub.c b/mm/slub.c index a505a828ef..0987d1cd94 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -2726,9 +2726,10 @@ size_t ksize(const void *object) page = virt_to_head_page(object); - if (unlikely(!PageSlab(page))) + if (unlikely(!PageSlab(page))) { + WARN_ON(!PageCompound(page)); return PAGE_SIZE << compound_order(page); - + } s = page->slab; #ifdef CONFIG_SLUB_DEBUG