From 0fd142b5877938c55d125a1597d3398db26c87d5 Mon Sep 17 00:00:00 2001 From: Vignesh Radhakrishnan Date: Thu, 14 May 2015 16:39:15 +0530 Subject: [PATCH] debugobjects: use kmemleak_not_leak for debug object memory debug objects are placed in a list obj_pool which is static. This is placed in __initdata which kmemleak will not scan unless task stack scan is enabled. We have taken the explicit choice of disabling task stack scan by default through the creation of config in the 'commit 7f15dd8a750e ("kmemleak : Make kmemleak_stack_scan optional using config")' Thus kmemleak would think that there is no reference to this and thus we will see this report as leaking memory. Further, this memory would be freed by the debugobjects framework when there is a memory crunch or when the object size exceeds the max limit of ODEBUG_POOL_SIZE. Fix this by using kmemleak_not_leak() when a debug object is allocated to specify explicitly that this is not a leak. Change-Id: I0ce66b1be4e5984681af9fd61883e7010e7bbd1b Signed-off-by: Vignesh Radhakrishnan Signed-off-by: Prasad Sodagudi --- lib/debugobjects.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/debugobjects.c b/lib/debugobjects.c index 547f7f923dbc..9ddee8c271a7 100644 --- a/lib/debugobjects.c +++ b/lib/debugobjects.c @@ -17,6 +17,7 @@ #include #include #include +#include #define ODEBUG_HASH_BITS 14 #define ODEBUG_HASH_SIZE (1 << ODEBUG_HASH_BITS) @@ -100,6 +101,7 @@ static void fill_pool(void) if (!new) return; + kmemleak_not_leak(new); raw_spin_lock_irqsave(&pool_lock, flags); hlist_add_head(&new->node, &obj_pool); obj_pool_free++;