From: Eric Dumazet <eric.dumazet@gmail.com>
To: Huajun Li <huajun.li.lee@gmail.com>
Cc: David Miller <davem@davemloft.net>, netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH 1/2] net: Disable false positive memory leak report
Date: Mon, 26 Sep 2011 07:29:18 +0200 [thread overview]
Message-ID: <1317014958.2853.0.camel@edumazet-laptop> (raw)
In-Reply-To: <CA+v9cxao_66a1Jb2L4M3fmUvNv8+QzWTFMqu7Dxnh7a5Zyqt0g@mail.gmail.com>
Le samedi 24 septembre 2011 à 23:57 +0800, Huajun Li a écrit :
> Memory leak detector reports following false positive memory leak, the
> patch disables it.
>
> unreferenced object 0xffff880073a70000 (size 8192):
> comm "swapper", pid 1, jiffies 4294937832 (age 445.740s)
> hex dump (first 32 bytes):
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> backtrace:
> [<ffffffff8124db64>] create_object+0x144/0x360
> [<ffffffff8191192e>] kmemleak_alloc+0x7e/0x110
> [<ffffffff81235b26>] __kmalloc_node+0x156/0x3a0
> [<ffffffff81935512>] flow_cache_cpu_prepare.clone.1+0x58/0xc0
> [<ffffffff8214c361>] flow_cache_init_global+0xb6/0x1af
> [<ffffffff8100225d>] do_one_initcall+0x4d/0x260
> [<ffffffff820ec2e9>] kernel_init+0x161/0x23a
> [<ffffffff8194ab04>] kernel_thread_helper+0x4/0x10
> [<ffffffffffffffff>] 0xffffffffffffffff
> unreferenced object 0xffff880073a74290 (size 8192):
> comm "swapper", pid 1, jiffies 4294937832 (age 445.740s)
> hex dump (first 32 bytes):
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> backtrace:
> [<ffffffff8124db64>] create_object+0x144/0x360
> [<ffffffff8191192e>] kmemleak_alloc+0x7e/0x110
> [<ffffffff81235b26>] __kmalloc_node+0x156/0x3a0
> [<ffffffff81935512>] flow_cache_cpu_prepare.clone.1+0x58/0xc0
> [<ffffffff8214c361>] flow_cache_init_global+0xb6/0x1af
> [<ffffffff8100225d>] do_one_initcall+0x4d/0x260
> [<ffffffff820ec2e9>] kernel_init+0x161/0x23a
> [<ffffffff8194ab04>] kernel_thread_helper+0x4/0x10
> [<ffffffffffffffff>] 0xffffffffffffffff
>
>
> Signed-off-by: Huajun Li <huajun.li.lee@gmail.com>
> ---
> net/core/flow.c | 7 +++++++
> 1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/net/core/flow.c b/net/core/flow.c
> index 555a456..ba3e617 100644
> --- a/net/core/flow.c
> +++ b/net/core/flow.c
> @@ -365,6 +365,13 @@ static int __cpuinit
> flow_cache_cpu_prepare(struct flow_cache *fc, int cpu)
>
> if (!fcp->hash_table) {
> fcp->hash_table = kzalloc_node(sz, GFP_KERNEL, cpu_to_node(cpu));
> + /*
> + * Avoid a kmemleak false positive. The pointer to this block
> + * is refferenced by per-CPU varaible, here just mark it as not
> + * being a leak.
> + */
> + kmemleak_not_leak(fcp->hash_table);
> +
> if (!fcp->hash_table) {
> pr_err("NET: failed to allocate flow cache sz %zu\n", sz);
> return -ENOMEM;
This makes no sense to me.
per-cpu variables are taken into account by kmemleak.
If not, you should report this problem to kmemleak maintainer.
next prev parent reply other threads:[~2011-09-26 5:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-24 15:57 [PATCH 1/2] net: Disable false positive memory leak report Huajun Li
2011-09-26 5:29 ` Eric Dumazet [this message]
2011-09-26 8:42 ` Huajun Li
2011-09-26 9:46 ` Eric Dumazet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1317014958.2853.0.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=huajun.li.lee@gmail.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox