diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2009-07-07 10:32:59 +0100 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2009-07-08 14:25:14 +0100 |
commit | e4f7c0b44a8ac8935f223195af9ea637d0c08091 (patch) | |
tree | 9d8627800137ae50a1d5707c21489969c77c9e8a /mm/slub.c | |
parent | 2587362eaf5c9df4e08de11e6340e3c4a88ed4c8 (diff) | |
download | lwn-e4f7c0b44a8ac8935f223195af9ea637d0c08091.tar.gz lwn-e4f7c0b44a8ac8935f223195af9ea637d0c08091.zip |
kmemleak: Trace the kmalloc_large* functions in slub
The kmalloc_large() and kmalloc_large_node() functions were missed when
adding the kmemleak hooks to the slub allocator. However, they should be
traced to avoid false positives.
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christoph Lameter <cl@linux-foundation.org>
Acked-by: Pekka Enberg <penberg@cs.helsinki.fi>
Diffstat (limited to 'mm/slub.c')
-rw-r--r-- | mm/slub.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/mm/slub.c b/mm/slub.c index a9201d83178b..b9f1491a58a1 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -21,7 +21,6 @@ #include <linux/kmemcheck.h> #include <linux/cpu.h> #include <linux/cpuset.h> -#include <linux/kmemleak.h> #include <linux/mempolicy.h> #include <linux/ctype.h> #include <linux/debugobjects.h> @@ -2835,13 +2834,15 @@ EXPORT_SYMBOL(__kmalloc); static void *kmalloc_large_node(size_t size, gfp_t flags, int node) { struct page *page; + void *ptr = NULL; flags |= __GFP_COMP | __GFP_NOTRACK; page = alloc_pages_node(node, flags, get_order(size)); if (page) - return page_address(page); - else - return NULL; + ptr = page_address(page); + + kmemleak_alloc(ptr, size, 1, flags); + return ptr; } #ifdef CONFIG_NUMA @@ -2926,6 +2927,7 @@ void kfree(const void *x) page = virt_to_head_page(x); if (unlikely(!PageSlab(page))) { BUG_ON(!PageCompound(page)); + kmemleak_free(x); put_page(page); return; } |