From: Yuezhang Mo Date: Tue, 13 Dec 2022 01:40:32 +0000 (+0800) Subject: exfat: fix overflow in sector and cluster conversion X-Git-Tag: v6.6.7~3885^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=40306b4d1ba25970dafd53432e8daa5d591ebd99;p=platform%2Fkernel%2Flinux-starfive.git exfat: fix overflow in sector and cluster conversion According to the exFAT specification, there are at most 2^32-11 clusters in a volume. so using 'int' is not enough for cluster index, the return value type of exfat_sector_to_cluster() should be 'unsigned int'. Signed-off-by: Yuezhang Mo Reviewed-by: Sungjong Seo Signed-off-by: Namjae Jeon --- diff --git a/fs/exfat/exfat_fs.h b/fs/exfat/exfat_fs.h index a1e7feb..bc6d21d 100644 --- a/fs/exfat/exfat_fs.h +++ b/fs/exfat/exfat_fs.h @@ -400,7 +400,7 @@ static inline sector_t exfat_cluster_to_sector(struct exfat_sb_info *sbi, sbi->data_start_sector; } -static inline int exfat_sector_to_cluster(struct exfat_sb_info *sbi, +static inline unsigned int exfat_sector_to_cluster(struct exfat_sb_info *sbi, sector_t sec) { return ((sec - sbi->data_start_sector) >> sbi->sect_per_clus_bits) +