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 7f15dd8a75.

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 <vigneshr@codeaurora.org>
This commit is contained in:
Vignesh Radhakrishnan 2015-05-14 16:39:15 +05:30 committed by Gerrit - the friendly Code Review server
parent 18a00f812c
commit 240131fcab

View File

@ -14,6 +14,7 @@
#include <linux/debugfs.h>
#include <linux/slab.h>
#include <linux/hash.h>
#include <linux/kmemleak.h>
#define ODEBUG_HASH_BITS 14
#define ODEBUG_HASH_SIZE (1 << ODEBUG_HASH_BITS)
@ -97,6 +98,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++;