Re: [PATCH v4 4/5] erofs: unify inline/share xattr iterators for listxattr/getxattr

From: Gao Xiang
Date: Wed May 31 2023 - 04:32:03 EST




On 2023/5/31 16:16, Jingbo Xu wrote:


On 5/31/23 2:57 PM, Gao Xiang wrote:


On 2023/5/31 11:13, Jingbo Xu wrote:
  -static int inline_xattr_iter_begin(struct erofs_xattr_iter *it,
-                   struct inode *inode)
-{
-    struct erofs_inode *const vi = EROFS_I(inode);
-    unsigned int xattr_header_sz, inline_xattr_ofs;
-
-    xattr_header_sz = sizeof(struct erofs_xattr_ibody_header) +
-              sizeof(u32) * vi->xattr_shared_count;
-    if (xattr_header_sz >= vi->xattr_isize) {
-        DBG_BUGON(xattr_header_sz > vi->xattr_isize);
-        return -ENOATTR;
-    }

In the original implementation, here when xattr_header_sz >=
vi->xattr_isize, inline_xattr_iter_begin() will return -ENOATTR rather
than a negative integer (i.e. vi->xattr_isize - xattr_header_sz).

Ah, sorry I misreaded that.

Thanks,
Gao Xiang