[PATCH] erofs-utils: fsck: skip erofs_verify_xattr() if xattr_isize is 0

Gao Xiang hsiangkao at linux.alibaba.com
Tue Aug 5 20:09:03 AEST 2025


erofs_dev_read() will fill with zeroes so this issue has no functional
impact, but this behavior will be changed.

Fixes: f44043561491 ("erofs-utils: introduce fsck.erofs")
Signed-off-by: Gao Xiang <hsiangkao at linux.alibaba.com>
---
 fsck/main.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/fsck/main.c b/fsck/main.c
index 44719b9..93de1cd 100644
--- a/fsck/main.c
+++ b/fsck/main.c
@@ -343,15 +343,12 @@ static int erofs_verify_xattr(struct erofs_inode *inode)
 	if (inode->xattr_isize == xattr_hdr_size) {
 		erofs_err("xattr_isize %d of nid %llu is not supported yet",
 			  inode->xattr_isize, inode->nid | 0ULL);
-		ret = -EFSCORRUPTED;
-		goto out;
+		return -EOPNOTSUPP;
 	} else if (inode->xattr_isize < xattr_hdr_size) {
-		if (inode->xattr_isize) {
-			erofs_err("bogus xattr ibody @ nid %llu",
-				  inode->nid | 0ULL);
-			ret = -EFSCORRUPTED;
-			goto out;
-		}
+		if (!inode->xattr_isize)
+			return 0;
+		erofs_err("bogus xattr ibody @ nid %llu", inode->nid | 0ULL);
+		return -EFSCORRUPTED;
 	}
 
 	addr = erofs_iloc(inode) + inode->inode_isize;
-- 
2.43.5



More information about the Linux-erofs mailing list