* [patch] sysfs: checking for NULL instead of ERR_PTR
@ 2010-08-25 7:12 Dan Carpenter
2010-08-25 8:42 ` Eric W. Biederman
2010-08-25 8:42 ` Eric W. Biederman
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2010-08-25 7:12 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Eric W. Biederman, Serge Hallyn, Stephen Hemminger, linux-kernel,
kernel-janitors
d_path() returns an ERR_PTR and it doesn't return NULL.
CC:stable@kernel.org
Signed-off-by: Dan Carpenter <error27@gmail.com>
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 */
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [patch] sysfs: checking for NULL instead of ERR_PTR
2010-08-25 7:12 [patch] sysfs: checking for NULL instead of ERR_PTR Dan Carpenter
@ 2010-08-25 8:42 ` Eric W. Biederman
2010-08-25 8:42 ` Eric W. Biederman
1 sibling, 0 replies; 3+ messages in thread
From: Eric W. Biederman @ 2010-08-25 8:42 UTC (permalink / raw)
To: Dan Carpenter
Cc: Greg Kroah-Hartman, Serge Hallyn, Stephen Hemminger, linux-kernel,
kernel-janitors
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 */
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] sysfs: checking for NULL instead of ERR_PTR
2010-08-25 7:12 [patch] sysfs: checking for NULL instead of ERR_PTR Dan Carpenter
2010-08-25 8:42 ` Eric W. Biederman
@ 2010-08-25 8:42 ` Eric W. Biederman
1 sibling, 0 replies; 3+ messages in thread
From: Eric W. Biederman @ 2010-08-25 8:42 UTC (permalink / raw)
To: Dan Carpenter
Cc: Greg Kroah-Hartman, Serge Hallyn, Stephen Hemminger, linux-kernel,
kernel-janitors
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 */
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-08-25 8:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-25 7:12 [patch] sysfs: checking for NULL instead of ERR_PTR Dan Carpenter
2010-08-25 8:42 ` Eric W. Biederman
2010-08-25 8:42 ` Eric W. Biederman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox