* [PATCH] SLUB: ksize() abuse checks
@ 2008-05-22 16:24 Pekka J Enberg
2008-05-22 16:50 ` Christoph Lameter
0 siblings, 1 reply; 2+ messages in thread
From: Pekka J Enberg @ 2008-05-22 16:24 UTC (permalink / raw)
To: clameter; +Cc: mpm, linux-kernel
From: Pekka Enberg <penberg@cs.helsinki.fi>
Add a WARN_ON for pages that don't have PageSlab nor PageCompound set to catch
the worst abusers of ksize() in the kernel.
Cc: Christoph Lameter <clameter@sgi.com>
Cc: Matt Mackall <mpm@selenic.com>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
mm/slub.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/mm/slub.c b/mm/slub.c
index a505a82..0987d1c 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
--
1.5.2.5
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] SLUB: ksize() abuse checks
2008-05-22 16:24 [PATCH] SLUB: ksize() abuse checks Pekka J Enberg
@ 2008-05-22 16:50 ` Christoph Lameter
0 siblings, 0 replies; 2+ messages in thread
From: Christoph Lameter @ 2008-05-22 16:50 UTC (permalink / raw)
To: Pekka J Enberg; +Cc: mpm, linux-kernel
Acked-by: Christoph Lameter <clameter@sgi.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-05-22 16:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-22 16:24 [PATCH] SLUB: ksize() abuse checks Pekka J Enberg
2008-05-22 16:50 ` Christoph Lameter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®