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>
This commit is contained in:
committed by
Ingo Molnar
parent
c826e3cd0c
commit
2121db74ba
@@ -3773,6 +3773,8 @@ void kfree(const void *objp)
|
||||
struct kmem_cache *c;
|
||||
unsigned long flags;
|
||||
|
||||
trace_kfree(_RET_IP_, objp);
|
||||
|
||||
if (unlikely(ZERO_OR_NULL_PTR(objp)))
|
||||
return;
|
||||
local_irq_save(flags);
|
||||
@@ -3782,8 +3784,6 @@ void kfree(const void *objp)
|
||||
debug_check_no_obj_freed(objp, obj_size(c));
|
||||
__cache_free(c, (void *)objp);
|
||||
local_irq_restore(flags);
|
||||
|
||||
trace_kfree(_RET_IP_, objp);
|
||||
}
|
||||
EXPORT_SYMBOL(kfree);
|
||||
|
||||
|
Reference in New Issue
Block a user