Skip to content

Commit 9cbc7e4

Browse files
committed
exfat: fix overflow issue in exfat_cluster_to_sector()
An overflow issue can occur at sector calculation in exfat_cluster_to_sector(). It needs to cast clus's type to sector_t before left shifting. Signed-off-by: Namjae Jeon <[email protected]>
1 parent d7fd859 commit 9cbc7e4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

exfat_fs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ static inline bool exfat_is_last_sector_in_cluster(struct exfat_sb_info *sbi,
381381
static inline sector_t exfat_cluster_to_sector(struct exfat_sb_info *sbi,
382382
unsigned int clus)
383383
{
384-
return ((clus - EXFAT_RESERVED_CLUSTERS) << sbi->sect_per_clus_bits) +
384+
return ((sector_t)(clus - EXFAT_RESERVED_CLUSTERS) << sbi->sect_per_clus_bits) +
385385
sbi->data_start_sector;
386386
}
387387

0 commit comments

Comments
 (0)