Skip to content

Commit 1b3567a

Browse files
lostjefflehsiangkao
authored andcommitted
erofs: fix potential overflow calculating xattr_isize
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: bfb8674 ("staging: erofs: add erofs in-memory stuffs") Signed-off-by: Jingbo Xu <jefflexu@linux.alibaba.com> Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com> Reviewed-by: Chao Yu <chao@kernel.org> Link: https://lore.kernel.org/r/20230414061810.6479-1-jefflexu@linux.alibaba.com Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
1 parent 4fdadd5 commit 1b3567a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/erofs/internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ struct erofs_inode {
304304

305305
unsigned char datalayout;
306306
unsigned char inode_isize;
307-
unsigned short xattr_isize;
307+
unsigned int xattr_isize;
308308

309309
unsigned int xattr_shared_count;
310310
unsigned int *xattr_shared_xattrs;

0 commit comments

Comments
 (0)