[PATCH] erofs: fix potential overflow calculating xattr_isize
Jingbo Xu
jefflexu at linux.alibaba.com
Fri Apr 14 16:18:10 AEST 2023
Given on-disk i_xattr_icount is 16 bits and xattr_isize is calculated
from i_xattr_icount multiplying 4, xattr_isize has a theoretical maximum
of 256K (64K * 4).
Thus declare xattr_isize as unsigned int to avoid the potential overflow.
Fixes: bfb8674dc044 ("staging: erofs: add erofs in-memory stuffs")
Signed-off-by: Jingbo Xu <jefflexu at linux.alibaba.com>
---
fs/erofs/internal.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h
index 8a563374b518..c86241a32ab3 100644
--- a/fs/erofs/internal.h
+++ b/fs/erofs/internal.h
@@ -306,7 +306,7 @@ struct erofs_inode {
unsigned char datalayout;
unsigned char inode_isize;
- unsigned short xattr_isize;
+ unsigned int xattr_isize;
unsigned int xattr_shared_count;
unsigned int *xattr_shared_xattrs;
--
2.19.1.6.gb485710b
More information about the Linux-erofs
mailing list