[PATCH 1/2] erofs-utils: lib: allow xattr e_name_index as 0
Gao Xiang
hsiangkao at linux.alibaba.com
Mon Jul 29 17:50:26 AEST 2024
Since it's implicitly supported since the initial EROFS kernel version.
It is particularly useful as an on-disk inode xattr placeholder for
on-disk core inode in-place updates, especially for root inodes because
"root_nid" recorded in the on-disk superblock is limited to 16 bits
for now.
Fixes: 1e429b74bff8 ("erofs-utils: lib: fix potential out-of-bound in xattr_entrylist()")
Signed-off-by: Gao Xiang <hsiangkao at linux.alibaba.com>
---
lib/xattr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/xattr.c b/lib/xattr.c
index 52c0ea4..563c688 100644
--- a/lib/xattr.c
+++ b/lib/xattr.c
@@ -1450,7 +1450,7 @@ static int xattr_entrylist(struct xattr_iter *_it,
base_index = pf->prefix->base_index;
}
- if (base_index >= ARRAY_SIZE(xattr_types))
+ if (!base_index || base_index >= ARRAY_SIZE(xattr_types))
return 1;
prefix = xattr_types[base_index].prefix;
prefix_len = xattr_types[base_index].prefix_len;
--
2.43.5
More information about the Linux-erofs
mailing list