summaryrefslogtreecommitdiff
path: root/kernel/smpboot.c
diff options
context:
space:
mode:
authorVignesh Radhakrishnan <vigneshr@codeaurora.org>2015-05-11 16:41:54 +0530
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 21:23:42 -0700
commit1723ce4914dfb3627329ec4abe6e69d081087e35 (patch)
tree2a938cb9025751b3abcffc7f5b5729e1a1036072 /kernel/smpboot.c
parent0fd503f905d573a6e83b8b891cf0e97c2aee2b7e (diff)
smpboot: use kmemleak_not_leak for smpboot_thread_data
Kmemleak reports the following memory leak : [<ffffffc0002faef8>] create_object+0x140/0x274 [<ffffffc000cc3598>] kmemleak_alloc+0x80/0xbc [<ffffffc0002f707c>] kmem_cache_alloc_trace+0x148/0x1d8 [<ffffffc00024504c>] __smpboot_create_thread.part.2+0x2c/0xec [<ffffffc0002452b4>] smpboot_register_percpu_thread+0x90/0x118 [<ffffffc0016067c0>] spawn_ksoftirqd+0x1c/0x30 [<ffffffc000200824>] do_one_initcall+0xb0/0x14c [<ffffffc001600820>] kernel_init_freeable+0x84/0x1e0 [<ffffffc000cc273c>] kernel_init+0x10/0xcc [<ffffffc000203bbc>] ret_from_fork+0xc/0x50 This memory allocated here points to smpboot_thread_data. Data is used as an argument for this kthread. This will be used when smpboot_thread_fn runs. Therefore, is not a leak. Call kmemleak_not_leak for smpboot_thread_data pointer to ensure that kmemleak doesn't report it as a memory leak. Change-Id: I02b0a7debea3907b606856e069d63d7991b67cd9 Signed-off-by: Vignesh Radhakrishnan <vigneshr@codeaurora.org> Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
Diffstat (limited to 'kernel/smpboot.c')
-rw-r--r--kernel/smpboot.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/smpboot.c b/kernel/smpboot.c
index d264f59bff56..6949476a118f 100644
--- a/kernel/smpboot.c
+++ b/kernel/smpboot.c
@@ -13,6 +13,7 @@
#include <linux/percpu.h>
#include <linux/kthread.h>
#include <linux/smpboot.h>
+#include <linux/kmemleak.h>
#include "smpboot.h"
@@ -177,6 +178,8 @@ __smpboot_create_thread(struct smp_hotplug_thread *ht, unsigned int cpu)
td = kzalloc_node(sizeof(*td), GFP_KERNEL, cpu_to_node(cpu));
if (!td)
return -ENOMEM;
+
+ kmemleak_not_leak(td);
td->cpu = cpu;
td->ht = ht;