diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2009-07-07 05:32:59 -0400 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2009-07-08 09:25:14 -0400 |
commit | e4f7c0b44a8ac8935f223195af9ea637d0c08091 (patch) | |
tree | 9d8627800137ae50a1d5707c21489969c77c9e8a /mm/slub.c | |
parent | 2587362eaf5c9df4e08de11e6340e3c4a88ed4c8 (diff) |
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
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/kmemcheck.h> | 21 | #include <linux/kmemcheck.h> |
22 | #include <linux/cpu.h> | 22 | #include <linux/cpu.h> |
23 | #include <linux/cpuset.h> | 23 | #include <linux/cpuset.h> |
24 | #include <linux/kmemleak.h> | ||
25 | #include <linux/mempolicy.h> | 24 | #include <linux/mempolicy.h> |
26 | #include <linux/ctype.h> | 25 | #include <linux/ctype.h> |
27 | #include <linux/debugobjects.h> | 26 | #include <linux/debugobjects.h> |
@@ -2835,13 +2834,15 @@ EXPORT_SYMBOL(__kmalloc); | |||
2835 | static void *kmalloc_large_node(size_t size, gfp_t flags, int node) | 2834 | static void *kmalloc_large_node(size_t size, gfp_t flags, int node) |
2836 | { | 2835 | { |
2837 | struct page *page; | 2836 | struct page *page; |
2837 | void *ptr = NULL; | ||
2838 | 2838 | ||
2839 | flags |= __GFP_COMP | __GFP_NOTRACK; | 2839 | flags |= __GFP_COMP | __GFP_NOTRACK; |
2840 | page = alloc_pages_node(node, flags, get_order(size)); | 2840 | page = alloc_pages_node(node, flags, get_order(size)); |
2841 | if (page) | 2841 | if (page) |
2842 | return page_address(page); | 2842 | ptr = page_address(page); |
2843 | else | 2843 | |
2844 | return NULL; | 2844 | kmemleak_alloc(ptr, size, 1, flags); |
2845 | return ptr; | ||
2845 | } | 2846 | } |
2846 | 2847 | ||
2847 | #ifdef CONFIG_NUMA | 2848 | #ifdef CONFIG_NUMA |
@@ -2926,6 +2927,7 @@ void kfree(const void *x) | |||
2926 | page = virt_to_head_page(x); | 2927 | page = virt_to_head_page(x); |
2927 | if (unlikely(!PageSlab(page))) { | 2928 | if (unlikely(!PageSlab(page))) { |
2928 | BUG_ON(!PageCompound(page)); | 2929 | BUG_ON(!PageCompound(page)); |
2930 | kmemleak_free(x); | ||
2929 | put_page(page); | 2931 | put_page(page); |
2930 | return; | 2932 | return; |
2931 | } | 2933 | } |