From: Jingbo Xu Date: Fri, 14 Apr 2023 06:18:10 +0000 (+0800) Subject: erofs: fix potential overflow calculating xattr_isize X-Git-Tag: v6.6.17~5076^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1b3567a1969b26f709d82a874498c0754ea841c3;p=platform%2Fkernel%2Flinux-rpi.git 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: bfb8674dc044 ("staging: erofs: add erofs in-memory stuffs") Signed-off-by: Jingbo Xu Reviewed-by: Gao Xiang Reviewed-by: Chao Yu Link: https://lore.kernel.org/r/20230414061810.6479-1-jefflexu@linux.alibaba.com Signed-off-by: Gao Xiang --- diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h index f1268cb..b5e91d7 100644 --- a/fs/erofs/internal.h +++ b/fs/erofs/internal.h @@ -304,7 +304,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;