Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1723357
| From | Dan Carpenter <dan.carpenter@oracle.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] kernfs: checking for IS_ERR() instead of NULL |
| Date | 2017-08-30 16:10 +0200 |
| Message-ID | <ukbQS-R3-3@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
The kernfs_get_inode() returns NULL on error, it never returns error
pointers.
Fixes: aa8188253474 ("kernfs: add exportfs operations")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c
index 7c452f4d83e9..95a7c88baed9 100644
--- a/fs/kernfs/mount.c
+++ b/fs/kernfs/mount.c
@@ -99,8 +99,8 @@ static struct inode *kernfs_fh_get_inode(struct super_block *sb,
return ERR_PTR(-ESTALE);
inode = kernfs_get_inode(sb, kn);
kernfs_put(kn);
- if (IS_ERR(inode))
- return ERR_CAST(inode);
+ if (!inode)
+ return ERR_PTR(-ESTALE);
if (generation && inode->i_generation != generation) {
/* we didn't find the right inode.. */
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH] kernfs: checking for IS_ERR() instead of NULL Dan Carpenter <dan.carpenter@oracle.com> - 2017-08-30 16:10 +0200
Re: [PATCH] kernfs: checking for IS_ERR() instead of NULL Tejun Heo <tj@kernel.org> - 2017-08-31 02:40 +0200
Re: [PATCH] kernfs: checking for IS_ERR() instead of NULL Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-31 19:00 +0200
Re: [PATCH] kernfs: checking for IS_ERR() instead of NULL Jens Axboe <axboe@kernel.dk> - 2017-08-31 22:00 +0200
Re: [PATCH] kernfs: checking for IS_ERR() instead of NULL Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-09-01 07:10 +0200
Re: [PATCH] kernfs: checking for IS_ERR() instead of NULL Jens Axboe <axboe@kernel.dk> - 2017-09-01 16:20 +0200
csiph-web