linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ceph: Fix NULL vs IS_ERR checking in ceph_getattr
@ 2022-11-10  3:13 Miaoqian Lin
  2022-11-10  5:44 ` Xiubo Li
  0 siblings, 1 reply; 3+ messages in thread
From: Miaoqian Lin @ 2022-11-10  3:13 UTC (permalink / raw)
  To: Xiubo Li, Ilya Dryomov, Jeff Layton, ceph-devel, linux-kernel; +Cc: linmq006

The ceph_lookup_inode() function return error pointers on error
instead of NULL.
Use IS_ERR() to check the return value to fix this.

Fixes: aa87052dd965 ("ceph: fix incorrectly showing the .snap size for stat")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 fs/ceph/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index 4af5e55abc15..bad9eeb6a1a5 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -2492,7 +2492,7 @@ int ceph_getattr(struct user_namespace *mnt_userns, const struct path *path,
 			struct inode *parent;
 
 			parent = ceph_lookup_inode(sb, ceph_ino(inode));
-			if (!parent)
+			if (IS_ERR(parent))
 				return PTR_ERR(parent);
 
 			pci = ceph_inode(parent);
-- 
2.37.3.671.ge2130fe6da78.dirty


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

* Re: [PATCH] ceph: Fix NULL vs IS_ERR checking in ceph_getattr
  2022-11-10  3:13 [PATCH] ceph: Fix NULL vs IS_ERR checking in ceph_getattr Miaoqian Lin
@ 2022-11-10  5:44 ` Xiubo Li
  2022-11-10 11:24   ` Ilya Dryomov
  0 siblings, 1 reply; 3+ messages in thread
From: Xiubo Li @ 2022-11-10  5:44 UTC (permalink / raw)
  To: Miaoqian Lin, Ilya Dryomov, Jeff Layton, ceph-devel, linux-kernel

Hi Miaoqian,

Thanks for your patch. This has already been fixed by Dan Carpenter 
weeks ago and already in the ceph-client's testing branch, please see [1]:

[1] 
https://github.com/ceph/ceph-client/commit/ffc4d66a34bb5bd76d0a3f83bebf500d96a8e37c

BRs

- Xiubo

On 10/11/2022 11:13, Miaoqian Lin wrote:
> The ceph_lookup_inode() function return error pointers on error
> instead of NULL.
> Use IS_ERR() to check the return value to fix this.
>
> Fixes: aa87052dd965 ("ceph: fix incorrectly showing the .snap size for stat")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
>   fs/ceph/inode.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
> index 4af5e55abc15..bad9eeb6a1a5 100644
> --- a/fs/ceph/inode.c
> +++ b/fs/ceph/inode.c
> @@ -2492,7 +2492,7 @@ int ceph_getattr(struct user_namespace *mnt_userns, const struct path *path,
>   			struct inode *parent;
>   
>   			parent = ceph_lookup_inode(sb, ceph_ino(inode));
> -			if (!parent)
> +			if (IS_ERR(parent))
>   				return PTR_ERR(parent);
>   
>   			pci = ceph_inode(parent);


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

* Re: [PATCH] ceph: Fix NULL vs IS_ERR checking in ceph_getattr
  2022-11-10  5:44 ` Xiubo Li
@ 2022-11-10 11:24   ` Ilya Dryomov
  0 siblings, 0 replies; 3+ messages in thread
From: Ilya Dryomov @ 2022-11-10 11:24 UTC (permalink / raw)
  To: Xiubo Li; +Cc: Miaoqian Lin, Jeff Layton, ceph-devel, linux-kernel

On Thu, Nov 10, 2022 at 6:45 AM Xiubo Li <xiubli@redhat.com> wrote:
>
> Hi Miaoqian,
>
> Thanks for your patch. This has already been fixed by Dan Carpenter
> weeks ago and already in the ceph-client's testing branch, please see [1]:
>
> [1]
> https://github.com/ceph/ceph-client/commit/ffc4d66a34bb5bd76d0a3f83bebf500d96a8e37c

It's also present in linux-next:

https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=ffc4d66a34bb5bd76d0a3f83bebf500d96a8e37c

Thanks,

                Ilya

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

end of thread, other threads:[~2022-11-10 11:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-10  3:13 [PATCH] ceph: Fix NULL vs IS_ERR checking in ceph_getattr Miaoqian Lin
2022-11-10  5:44 ` Xiubo Li
2022-11-10 11:24   ` Ilya Dryomov

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).