Commit 76994412f8e824e79a593d6777ec327d85f942b2

Authored by Pekka Enberg
1 parent 239f49c080

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 <clameter@sgi.com>
Cc: Matt Mackall <mpm@selenic.com>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>

Showing 1 changed file with 3 additions and 2 deletions Side-by-side Diff

... ... @@ -2726,9 +2726,10 @@
2726 2726  
2727 2727 page = virt_to_head_page(object);
2728 2728  
2729   - if (unlikely(!PageSlab(page)))
  2729 + if (unlikely(!PageSlab(page))) {
  2730 + WARN_ON(!PageCompound(page));
2730 2731 return PAGE_SIZE << compound_order(page);
2731   -
  2732 + }
2732 2733 s = page->slab;
2733 2734  
2734 2735 #ifdef CONFIG_SLUB_DEBUG