Skip to content

Commit

Permalink
exfat: fix overflow issue in exfat_cluster_to_sector()
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
namjaejeon committed Jul 21, 2020
1 parent ba47d84 commit 43946b7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/exfat/exfat_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ static inline bool exfat_is_last_sector_in_cluster(struct exfat_sb_info *sbi,
static inline sector_t exfat_cluster_to_sector(struct exfat_sb_info *sbi,
unsigned int clus)
{
return ((clus - EXFAT_RESERVED_CLUSTERS) << sbi->sect_per_clus_bits) +
return ((sector_t)(clus - EXFAT_RESERVED_CLUSTERS) << sbi->sect_per_clus_bits) +
sbi->data_start_sector;
}

Expand Down

0 comments on commit 43946b7

Please sign in to comment.