Message ID | Y0kttQIe0+2Rw+SP@kili (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | ceph: fix a NULL vs IS_ERR() check | expand |
On Fri, 2022-10-14 at 12:36 +0300, Dan Carpenter wrote: > 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> > --- > 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); Reviewed-by: Jeff Layton <jlayton@kernel.org>
On 14/10/2022 17:36, Dan Carpenter wrote: > 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> > --- > 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); Good catch! Will merge it to the testing branch soon. Thanks Dan. - Xiubo
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);
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> --- fs/ceph/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)