From patchwork Sat Sep 24 15:57:06 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: huajun li X-Patchwork-Id: 116226 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 69EAFB6F77 for ; Sun, 25 Sep 2011 01:57:17 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751691Ab1IXP5J (ORCPT ); Sat, 24 Sep 2011 11:57:09 -0400 Received: from mail-fx0-f46.google.com ([209.85.161.46]:37651 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751385Ab1IXP5H (ORCPT ); Sat, 24 Sep 2011 11:57:07 -0400 Received: by fxe4 with SMTP id 4so4732097fxe.19 for ; Sat, 24 Sep 2011 08:57:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=Jjc7xORqyGlMFgAHBmmc4qIn1xq1hhOITqGSDSXC3FM=; b=O+i3onqUXXyaSba4EpCK79vHKQGv80YKYEoNIVPk/Xe+uyy4GUGxA+lvTupCD19awt KSQrThO3GpCkiEq/6OPc+uPMWI8x6s2CjdBrBw3x3ww8+JsdNN+nWJEunVV9BShhgHoD WKx0VbE2j3a/1hfDpbbYMwqgTy0yiHxgCvJ9Q= MIME-Version: 1.0 Received: by 10.223.47.216 with SMTP id o24mr7140446faf.145.1316879826147; Sat, 24 Sep 2011 08:57:06 -0700 (PDT) Received: by 10.223.114.195 with HTTP; Sat, 24 Sep 2011 08:57:06 -0700 (PDT) Date: Sat, 24 Sep 2011 23:57:06 +0800 Message-ID: Subject: [PATCH 1/2] net: Disable false positive memory leak report From: Huajun Li To: David Miller Cc: netdev , Huajun Li Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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: [] create_object+0x144/0x360 [] kmemleak_alloc+0x7e/0x110 [] __kmalloc_node+0x156/0x3a0 [] flow_cache_cpu_prepare.clone.1+0x58/0xc0 [] flow_cache_init_global+0xb6/0x1af [] do_one_initcall+0x4d/0x260 [] kernel_init+0x161/0x23a [] kernel_thread_helper+0x4/0x10 [] 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: [] create_object+0x144/0x360 [] kmemleak_alloc+0x7e/0x110 [] __kmalloc_node+0x156/0x3a0 [] flow_cache_cpu_prepare.clone.1+0x58/0xc0 [] flow_cache_init_global+0xb6/0x1af [] do_one_initcall+0x4d/0x260 [] kernel_init+0x161/0x23a [] kernel_thread_helper+0x4/0x10 [] 0xffffffffffffffff Signed-off-by: Huajun Li --- net/core/flow.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) return -ENOMEM; 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);