From 1723ce4914dfb3627329ec4abe6e69d081087e35 Mon Sep 17 00:00:00 2001 From: Vignesh Radhakrishnan Date: Mon, 11 May 2015 16:41:54 +0530 Subject: smpboot: use kmemleak_not_leak for smpboot_thread_data Kmemleak reports the following memory leak : [] create_object+0x140/0x274 [] kmemleak_alloc+0x80/0xbc [] kmem_cache_alloc_trace+0x148/0x1d8 [] __smpboot_create_thread.part.2+0x2c/0xec [] smpboot_register_percpu_thread+0x90/0x118 [] spawn_ksoftirqd+0x1c/0x30 [] do_one_initcall+0xb0/0x14c [] kernel_init_freeable+0x84/0x1e0 [] kernel_init+0x10/0xcc [] 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 Signed-off-by: Prasad Sodagudi --- kernel/smpboot.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'kernel') 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 #include #include +#include #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; -- cgit v1.2.3