diff options
author | Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> | 2005-08-26 10:57:53 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-08-26 14:39:19 -0400 |
commit | fd589e0b662c1ea8cfb1e0d20d60a2510979865b (patch) | |
tree | 5c281ab99184fa6dcfb09586064ea7751c32fd4c /fs | |
parent | d7a60d50d7713b65a3fd88f11d5717b83a6b6a97 (diff) |
[PATCH] hppfs: fix symlink error path
While touching this code I noticed the error handling is bogus, so I
fixed it up.
I've removed the IS_ERR(proc_dentry) check, which will never trigger and
is clearly a typo: we must check proc_file instead.
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/hppfs/hppfs_kern.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/fs/hppfs/hppfs_kern.c b/fs/hppfs/hppfs_kern.c index 385d440fa234..52930915bad8 100644 --- a/fs/hppfs/hppfs_kern.c +++ b/fs/hppfs/hppfs_kern.c | |||
@@ -38,7 +38,7 @@ struct hppfs_inode_info { | |||
38 | 38 | ||
39 | static inline struct hppfs_inode_info *HPPFS_I(struct inode *inode) | 39 | static inline struct hppfs_inode_info *HPPFS_I(struct inode *inode) |
40 | { | 40 | { |
41 | return(list_entry(inode, struct hppfs_inode_info, vfs_inode)); | 41 | return container_of(inode, struct hppfs_inode_info, vfs_inode); |
42 | } | 42 | } |
43 | 43 | ||
44 | #define HPPFS_SUPER_MAGIC 0xb00000ee | 44 | #define HPPFS_SUPER_MAGIC 0xb00000ee |
@@ -662,38 +662,32 @@ static int hppfs_readlink(struct dentry *dentry, char *buffer, int buflen) | |||
662 | { | 662 | { |
663 | struct file *proc_file; | 663 | struct file *proc_file; |
664 | struct dentry *proc_dentry; | 664 | struct dentry *proc_dentry; |
665 | int (*readlink)(struct dentry *, char *, int); | 665 | int ret; |
666 | int err, n; | ||
667 | 666 | ||
668 | proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry; | 667 | proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry; |
669 | proc_file = dentry_open(dget(proc_dentry), NULL, O_RDONLY); | 668 | proc_file = dentry_open(dget(proc_dentry), NULL, O_RDONLY); |
670 | err = PTR_ERR(proc_dentry); | 669 | if (IS_ERR(proc_file)) |
671 | if(IS_ERR(proc_dentry)) | 670 | return PTR_ERR(proc_file); |
672 | return(err); | ||
673 | 671 | ||
674 | readlink = proc_dentry->d_inode->i_op->readlink; | 672 | ret = proc_dentry->d_inode->i_op->readlink(proc_dentry, buffer, buflen); |
675 | n = (*readlink)(proc_dentry, buffer, buflen); | ||
676 | 673 | ||
677 | fput(proc_file); | 674 | fput(proc_file); |
678 | 675 | ||
679 | return(n); | 676 | return ret; |
680 | } | 677 | } |
681 | 678 | ||
682 | static void* hppfs_follow_link(struct dentry *dentry, struct nameidata *nd) | 679 | static void* hppfs_follow_link(struct dentry *dentry, struct nameidata *nd) |
683 | { | 680 | { |
684 | struct file *proc_file; | 681 | struct file *proc_file; |
685 | struct dentry *proc_dentry; | 682 | struct dentry *proc_dentry; |
686 | void * (*follow_link)(struct dentry *, struct nameidata *); | ||
687 | void *ret; | 683 | void *ret; |
688 | 684 | ||
689 | proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry; | 685 | proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry; |
690 | proc_file = dentry_open(dget(proc_dentry), NULL, O_RDONLY); | 686 | proc_file = dentry_open(dget(proc_dentry), NULL, O_RDONLY); |
687 | if (IS_ERR(proc_file)) | ||
688 | return proc_file; | ||
691 | 689 | ||
692 | if (IS_ERR(proc_dentry)) | 690 | ret = proc_dentry->d_inode->i_op->follow_link(proc_dentry, nd); |
693 | return proc_dentry; | ||
694 | |||
695 | follow_link = proc_dentry->d_inode->i_op->follow_link; | ||
696 | ret = (*follow_link)(proc_dentry, nd); | ||
697 | 691 | ||
698 | fput(proc_file); | 692 | fput(proc_file); |
699 | 693 | ||