mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-07 13:43:51 +00:00
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>
This commit is contained in:
parent
239f49c080
commit
76994412f8
@ -2726,9 +2726,10 @@ size_t ksize(const void *object)
|
|||||||
|
|
||||||
page = virt_to_head_page(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);
|
return PAGE_SIZE << compound_order(page);
|
||||||
|
}
|
||||||
s = page->slab;
|
s = page->slab;
|
||||||
|
|
||||||
#ifdef CONFIG_SLUB_DEBUG
|
#ifdef CONFIG_SLUB_DEBUG
|
||||||
|
Loading…
Reference in New Issue
Block a user