From 2121db74ba0fd2259f0e2265511684fadda9ac49 Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Wed, 25 Mar 2009 11:05:57 +0200 Subject: 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 Cc: Eduard - Gabriel Munteanu LKML-Reference: <1237971957.30175.18.camel@penberg-laptop> Signed-off-by: Ingo Molnar --- mm/slub.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mm/slub.c') diff --git a/mm/slub.c b/mm/slub.c index a98078bf738b..7ab54ecbd3f3 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -2792,6 +2792,8 @@ void kfree(const void *x) struct page *page; void *object = (void *)x; + trace_kfree(_RET_IP_, x); + if (unlikely(ZERO_OR_NULL_PTR(x))) return; @@ -2802,8 +2804,6 @@ void kfree(const void *x) return; } slab_free(page->slab, page, object, _RET_IP_); - - trace_kfree(_RET_IP_, x); } EXPORT_SYMBOL(kfree); -- cgit v1.2.3-55-g7522