Skip to contentSkip to conversation

ceph: Fix NULL vs IS_ERR checking in ceph_getattr

PATCH In review Miaoqian Lin 3 participants 3 messages Nov 10, 2022 Ceph client

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ceph: Fix NULL vs IS_ERR checking in ceph_getattr

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")
---
 fs/ceph/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ceph/inode.c +1 -1
index 4af5e55abc15..bad9eeb6a1a5 100644
@@ -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);
Signature · 1 line
2.37.3.671.ge2130fe6da78.dirty
#1 lore raw

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

Quoted 23 lines · Miaoqian Lin

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")
---
  fs/ceph/inode.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
fs/ceph/inode.c +1 -1
index 4af5e55abc15..bad9eeb6a1a5 100644
@@ -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);