ceph: fix a NULL vs IS_ERR() check when calling ceph_lookup_inode()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 14 Oct 2022 09:36:53 +0000 (12:36 +0300)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 14 Nov 2022 09:29:05 +0000 (10:29 +0100)
The ceph_lookup_inode() function returns error pointers.  It never
returns NULL.

Fixes: aa87052dd965 ("ceph: fix incorrectly showing the .snap size for stat")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Xiubo Li <xiubli@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/ceph/inode.c

index 4af5e55..bad9eeb 100644 (file)
@@ -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);