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/slab.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/slab.c')
-rw-r--r-- | mm/slab.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -3773,6 +3773,8 @@ void kfree(const void *objp) | |||
3773 | struct kmem_cache *c; | 3773 | struct kmem_cache *c; |
3774 | unsigned long flags; | 3774 | unsigned long flags; |
3775 | 3775 | ||
3776 | trace_kfree(_RET_IP_, objp); | ||
3777 | |||
3776 | if (unlikely(ZERO_OR_NULL_PTR(objp))) | 3778 | if (unlikely(ZERO_OR_NULL_PTR(objp))) |
3777 | return; | 3779 | return; |
3778 | local_irq_save(flags); | 3780 | local_irq_save(flags); |
@@ -3782,8 +3784,6 @@ void kfree(const void *objp) | |||
3782 | debug_check_no_obj_freed(objp, obj_size(c)); | 3784 | debug_check_no_obj_freed(objp, obj_size(c)); |
3783 | __cache_free(c, (void *)objp); | 3785 | __cache_free(c, (void *)objp); |
3784 | local_irq_restore(flags); | 3786 | local_irq_restore(flags); |
3785 | |||
3786 | trace_kfree(_RET_IP_, objp); | ||
3787 | } | 3787 | } |
3788 | EXPORT_SYMBOL(kfree); | 3788 | EXPORT_SYMBOL(kfree); |
3789 | 3789 | ||