Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1723357 > unrolled thread

[PATCH] kernfs: checking for IS_ERR() instead of NULL

Started byDan Carpenter <dan.carpenter@oracle.com>
First post2017-08-30 16:10 +0200
Last post2017-09-01 16:20 +0200
Articles 6 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [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

#1723357 — [PATCH] kernfs: checking for IS_ERR() instead of NULL

FromDan Carpenter <dan.carpenter@oracle.com>
Date2017-08-30 16:10 +0200
Subject[PATCH] kernfs: checking for IS_ERR() instead of NULL
Message-ID<ukbQS-R3-3@gated-at.bofh.it>
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.. */

[toc] | [next] | [standalone]


#1723754

FromTejun Heo <tj@kernel.org>
Date2017-08-31 02:40 +0200
Message-ID<uklGy-6Vf-11@gated-at.bofh.it>
In reply to#1723357
On Wed, Aug 30, 2017 at 05:04:56PM +0300, Dan Carpenter wrote:
> 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>

Acked-by: Tejun Heo <tj@kernel.org>

Greg, can you please route this patch?

Thanks.

-- 
tejun

[toc] | [prev] | [next] | [standalone]


#1724421

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-08-31 19:00 +0200
Message-ID<ukAYX-85f-31@gated-at.bofh.it>
In reply to#1723357
On Wed, Aug 30, 2017 at 05:04:56PM +0300, Dan Carpenter wrote:
> 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>
> Acked-by: Tejun Heo <tj@kernel.org>

Hm, I don't know what tree aa8188253474 is in, but it's not mine, so I
can't take this patch :(

thanks,

greg k-h

[toc] | [prev] | [next] | [standalone]


#1724542

FromJens Axboe <axboe@kernel.dk>
Date2017-08-31 22:00 +0200
Message-ID<ukDN8-1yc-25@gated-at.bofh.it>
In reply to#1724421
On 08/31/2017 10:52 AM, Greg Kroah-Hartman wrote:
> On Wed, Aug 30, 2017 at 05:04:56PM +0300, Dan Carpenter wrote:
>> 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>
>> Acked-by: Tejun Heo <tj@kernel.org>
> 
> Hm, I don't know what tree aa8188253474 is in, but it's not mine, so I
> can't take this patch :(

It's in my tree, I'll take it. Can I add your
acked/reviewed/whatever-by?

-- 
Jens Axboe

[toc] | [prev] | [next] | [standalone]


#1724782

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-09-01 07:10 +0200
Message-ID<ukMno-7GJ-13@gated-at.bofh.it>
In reply to#1724542
On Thu, Aug 31, 2017 at 01:56:40PM -0600, Jens Axboe wrote:
> On 08/31/2017 10:52 AM, Greg Kroah-Hartman wrote:
> > On Wed, Aug 30, 2017 at 05:04:56PM +0300, Dan Carpenter wrote:
> >> 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>
> >> Acked-by: Tejun Heo <tj@kernel.org>
> > 
> > Hm, I don't know what tree aa8188253474 is in, but it's not mine, so I
> > can't take this patch :(
> 
> It's in my tree, I'll take it. Can I add your
> acked/reviewed/whatever-by?

Yes:

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

[toc] | [prev] | [next] | [standalone]


#1725118

FromJens Axboe <axboe@kernel.dk>
Date2017-09-01 16:20 +0200
Message-ID<ukUXD-6dR-1@gated-at.bofh.it>
In reply to#1723357
On 08/30/2017 08:04 AM, Dan Carpenter wrote:
> The kernfs_get_inode() returns NULL on error, it never returns error
> pointers.

Added for 4.14, with the ack from Tejun and Greg.

-- 
Jens Axboe

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web