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>
diff --git a/mm/slob.c b/mm/slob.c
index 0000358..a2d4ab3 100644
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -514,6 +514,8 @@
{
struct slob_page *sp;
+ trace_kfree(_RET_IP_, block);
+
if (unlikely(ZERO_OR_NULL_PTR(block)))
return;
@@ -524,8 +526,6 @@
slob_free(m, *m + align);
} else
put_page(&sp->page);
-
- trace_kfree(_RET_IP_, block);
}
EXPORT_SYMBOL(kfree);