]> Git Repo - J-linux.git/commitdiff
exfat: fix overflow in sector and cluster conversion
authorYuezhang Mo <[email protected]>
Tue, 13 Dec 2022 01:40:32 +0000 (09:40 +0800)
committerNamjae Jeon <[email protected]>
Tue, 13 Dec 2022 11:17:11 +0000 (20:17 +0900)
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 <[email protected]>
Reviewed-by: Sungjong Seo <[email protected]>
Signed-off-by: Namjae Jeon <[email protected]>
fs/exfat/exfat_fs.h

index a1e7feb2207977215ba93c91a3e4c30996fd90c5..bc6d21d7c5adf11580e2d8a3df6fc61386ecc09e 100644 (file)
@@ -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) +
This page took 0.05064 seconds and 4 git commands to generate.