sysfs: checking for NULL instead of ERR_PTR
Subsystems (2)
PATCH 1/1 sysfs: checking for NULL instead of ERR_PTR
d_path() returns an ERR_PTR and it doesn't return NULL.
Signed-off-by Dan Carpenter <[email protected]>
fs/sysfs/file.c +1 -1
@@ -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 */
Quoted 4 lines · Dan Carpenter
d_path()returns anERR_PTRand it doesn't return NULL.Signed-off-by Dan Carpenter <[email protected]>
This is definitely a needed bug fix.
Reviewed-by "Eric W. Biederman" <[email protected]>
If we ever get ERR_PTR(-ENAMETOOLONG) and this case actually matters something is very wrong with sysfs, but that is another story.
Eric
Quoted 13 lines
fs/sysfs/file.c +1
-1@@ -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 */
Quoted 4 lines · Dan Carpenter
d_path()returns anERR_PTRand it doesn't return NULL.Signed-off-by Dan Carpenter <[email protected]>
This is definitely a needed bug fix.
Reviewed-by "Eric W. Biederman" <[email protected]>
If we ever get ERR_PTR(-ENAMETOOLONG) and this case actually matters something is very wrong with sysfs, but that is another story.
Eric
Quoted 13 lines
fs/sysfs/file.c +1
-1@@ -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 */