diff options
author | Pekka Enberg <penberg@cs.helsinki.fi> | 2009-03-25 05:05:57 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-04-03 06:23:10 -0400 |
commit | 2121db74ba0fd2259f0e2265511684fadda9ac49 (patch) | |
tree | 823401f3bce7018535ceea69103a28accd5794f7 /mm/slub.c | |
parent | c826e3cd0c931d60d548f2468122da570d145556 (diff) |
kmemtrace: trace kfree() calls with NULL or zero-length objects
Impact: also output kfree(NULL) entries
This patch moves the trace_kfree() calls before the ZERO_OR_NULL_PTR
check so that we can trace call-sites that call kfree() with NULL many
times which might be an indication of a bug.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
LKML-Reference: <1237971957.30175.18.camel@penberg-laptop>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'mm/slub.c')
-rw-r--r-- | mm/slub.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -2792,6 +2792,8 @@ void kfree(const void *x) | |||
2792 | struct page *page; | 2792 | struct page *page; |
2793 | void *object = (void *)x; | 2793 | void *object = (void *)x; |
2794 | 2794 | ||
2795 | trace_kfree(_RET_IP_, x); | ||
2796 | |||
2795 | if (unlikely(ZERO_OR_NULL_PTR(x))) | 2797 | if (unlikely(ZERO_OR_NULL_PTR(x))) |
2796 | return; | 2798 | return; |
2797 | 2799 | ||
@@ -2802,8 +2804,6 @@ void kfree(const void *x) | |||
2802 | return; | 2804 | return; |
2803 | } | 2805 | } |
2804 | slab_free(page->slab, page, object, _RET_IP_); | 2806 | slab_free(page->slab, page, object, _RET_IP_); |
2805 | |||
2806 | trace_kfree(_RET_IP_, x); | ||
2807 | } | 2807 | } |
2808 | EXPORT_SYMBOL(kfree); | 2808 | EXPORT_SYMBOL(kfree); |
2809 | 2809 | ||