Skip to content

Commit 43946b7

Browse files
committed
exfat: fix overflow issue in exfat_cluster_to_sector()
An overflow issue can occur while calculating sector in exfat_cluster_to_sector(). It needs to cast clus's type to sector_t before left shifting. Fixes: 1acf1a5 ("exfat: add in-memory and on-disk structures and headers") Cc: [email protected] # v5.7 Reviewed-by: Sungjong Seo <[email protected]> Signed-off-by: Namjae Jeon <[email protected]>
1 parent ba47d84 commit 43946b7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/exfat/exfat_fs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ static inline bool exfat_is_last_sector_in_cluster(struct exfat_sb_info *sbi,
371371
static inline sector_t exfat_cluster_to_sector(struct exfat_sb_info *sbi,
372372
unsigned int clus)
373373
{
374-
return ((clus - EXFAT_RESERVED_CLUSTERS) << sbi->sect_per_clus_bits) +
374+
return ((sector_t)(clus - EXFAT_RESERVED_CLUSTERS) << sbi->sect_per_clus_bits) +
375375
sbi->data_start_sector;
376376
}
377377

0 commit comments

Comments
 (0)