linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kernfs: checking for IS_ERR() instead of NULL
@ 2017-08-30 14:04 Dan Carpenter
  2017-08-31  0:39 ` Tejun Heo
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Dan Carpenter @ 2017-08-30 14:04 UTC (permalink / raw)
  To: Shaohua Li, linux-block, Jens Axboe
  Cc: Tejun Heo, linux-kernel, Greg Kroah-Hartman, kernel-janitors

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.. */

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] kernfs: checking for IS_ERR() instead of NULL
  2017-08-30 14:04 [PATCH] kernfs: checking for IS_ERR() instead of NULL Dan Carpenter
@ 2017-08-31  0:39 ` Tejun Heo
  2017-08-31 16:52 ` Greg Kroah-Hartman
  2017-09-01 14:19 ` Jens Axboe
  2 siblings, 0 replies; 6+ messages in thread
From: Tejun Heo @ 2017-08-31  0:39 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Shaohua Li, linux-block, Jens Axboe, linux-kernel,
	Greg Kroah-Hartman, kernel-janitors

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] kernfs: checking for IS_ERR() instead of NULL
  2017-08-30 14:04 [PATCH] kernfs: checking for IS_ERR() instead of NULL Dan Carpenter
  2017-08-31  0:39 ` Tejun Heo
@ 2017-08-31 16:52 ` Greg Kroah-Hartman
  2017-08-31 19:56   ` Jens Axboe
  2017-09-01 14:19 ` Jens Axboe
  2 siblings, 1 reply; 6+ messages in thread
From: Greg Kroah-Hartman @ 2017-08-31 16:52 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Shaohua Li, linux-block, Jens Axboe, Tejun Heo, linux-kernel,
	kernel-janitors

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] kernfs: checking for IS_ERR() instead of NULL
  2017-08-31 16:52 ` Greg Kroah-Hartman
@ 2017-08-31 19:56   ` Jens Axboe
  2017-09-01  5:07     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 6+ messages in thread
From: Jens Axboe @ 2017-08-31 19:56 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Dan Carpenter
  Cc: Shaohua Li, linux-block, Tejun Heo, linux-kernel, kernel-janitors

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] kernfs: checking for IS_ERR() instead of NULL
  2017-08-31 19:56   ` Jens Axboe
@ 2017-09-01  5:07     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2017-09-01  5:07 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Dan Carpenter, Shaohua Li, linux-block, Tejun Heo, linux-kernel,
	kernel-janitors

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>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] kernfs: checking for IS_ERR() instead of NULL
  2017-08-30 14:04 [PATCH] kernfs: checking for IS_ERR() instead of NULL Dan Carpenter
  2017-08-31  0:39 ` Tejun Heo
  2017-08-31 16:52 ` Greg Kroah-Hartman
@ 2017-09-01 14:19 ` Jens Axboe
  2 siblings, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2017-09-01 14:19 UTC (permalink / raw)
  To: Dan Carpenter, Shaohua Li, linux-block
  Cc: Tejun Heo, linux-kernel, Greg Kroah-Hartman, kernel-janitors

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-09-01 14:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-30 14:04 [PATCH] kernfs: checking for IS_ERR() instead of NULL Dan Carpenter
2017-08-31  0:39 ` Tejun Heo
2017-08-31 16:52 ` Greg Kroah-Hartman
2017-08-31 19:56   ` Jens Axboe
2017-09-01  5:07     ` Greg Kroah-Hartman
2017-09-01 14:19 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).