Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eb7de3a4 authored by Yuezhang Mo's avatar Yuezhang Mo Committed by Namjae Jeon
Browse files

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: default avatarYuezhang Mo <Yuezhang.Mo@sony.com>
Reviewed-by: default avatarSungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
parent ba9c0dc4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -423,7 +423,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) +