All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bryan Schumaker <bjschuma@netapp.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	Trond Myklebust <Trond.Myklebust@netapp.com>
Subject: Re: [PATCH] nfs: Ignore kmemleak false positive in nfs_readdir_make_qstr
Date: Thu, 11 Nov 2010 09:51:10 -0500	[thread overview]
Message-ID: <4CDC02DE.6060700@netapp.com> (raw)
In-Reply-To: <1289480027-7361-1-git-send-email-catalin.marinas@arm.com>

Thanks!  The patch works for me.

Bryan

On 11/11/2010 07:53 AM, Catalin Marinas wrote:
> Strings allocated via kmemdup() in nfs_readdir_make_qstr() are
> referenced from the nfs_cache_array which is stored in a page cache
> page. Kmemleak does not scan such pages and it reports several false
> positives. This patch annotates the string->name pointer so that
> kmemleak does not consider it a real leak.
> 
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Bryan Schumaker <bjschuma@netapp.com>
> Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
> ---
>  fs/nfs/dir.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
> index 07ac384..a9f9e14 100644
> --- a/fs/nfs/dir.c
> +++ b/fs/nfs/dir.c
> @@ -34,6 +34,7 @@
>  #include <linux/mount.h>
>  #include <linux/sched.h>
>  #include <linux/vmalloc.h>
> +#include <linux/kmemleak.h>
>  
>  #include "delegation.h"
>  #include "iostat.h"
> @@ -231,6 +232,11 @@ int nfs_readdir_make_qstr(struct qstr *string, const char *name, unsigned int le
>  	string->name = kmemdup(name, len, GFP_KERNEL);
>  	if (string->name == NULL)
>  		return -ENOMEM;
> +	/*
> +	 * Avoid a kmemleak false positive. The pointer to the name is stored
> +	 * in a page cache page which kmemleak does not scan.
> +	 */
> +	kmemleak_not_leak(string->name);
>  	string->hash = full_name_hash(name, len);
>  	return 0;
>  }


      reply	other threads:[~2010-11-11 14:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-11 12:53 [PATCH] nfs: Ignore kmemleak false positive in nfs_readdir_make_qstr Catalin Marinas
2010-11-11 14:51 ` Bryan Schumaker [this message]

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=4CDC02DE.6060700@netapp.com \
    --to=bjschuma@netapp.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=catalin.marinas@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.