public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Dan Carpenter <error27@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>,
	Serge Hallyn <serue@us.ibm.com>,
	Stephen Hemminger <shemminger@vyatta.com>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] sysfs: checking for NULL instead of ERR_PTR
Date: Wed, 25 Aug 2010 01:42:31 -0700	[thread overview]
Message-ID: <m1d3t7f5hk.fsf@fess.ebiederm.org> (raw)
In-Reply-To: <20100825071229.GP29330@bicker> (Dan Carpenter's message of "Wed, 25 Aug 2010 09:12:29 +0200")

Dan Carpenter <error27@gmail.com> writes:

> d_path() returns an ERR_PTR and it doesn't return NULL.
>
> CC:stable@kernel.org
> Signed-off-by: Dan Carpenter <error27@gmail.com>

This is definitely a needed bug fix.

Reviewed-by: "Eric W. Biederman" <ebiederm@xmission.com>

If we ever get ERR_PTR(-ENAMETOOLONG) and this case actually matters 
something is very wrong with sysfs, but that is another story.

Eric


> diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
> index 1b27b56..da3fefe 100644
> --- a/fs/sysfs/file.c
> +++ b/fs/sysfs/file.c
> @@ -340,7 +340,7 @@ static int sysfs_open_file(struct inode *inode, struct file *file)
>  	char *p;
>  
>  	p = d_path(&file->f_path, last_sysfs_file, sizeof(last_sysfs_file));
> -	if (p)
> +	if (!IS_ERR(p))
>  		memmove(last_sysfs_file, p, strlen(p) + 1);
>  
>  	/* need attr_sd for attr and ops, its parent for kobj */

  reply	other threads:[~2010-08-25  8:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-25  7:12 [patch] sysfs: checking for NULL instead of ERR_PTR Dan Carpenter
2010-08-25  8:42 ` Eric W. Biederman [this message]
2010-08-25  8:42 ` Eric W. Biederman

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=m1d3t7f5hk.fsf@fess.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=error27@gmail.com \
    --cc=gregkh@suse.de \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=serue@us.ibm.com \
    --cc=shemminger@vyatta.com \
    /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