Skip to content
This repository has been archived by the owner on Apr 10, 2024. It is now read-only.

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 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]>
  • Loading branch information
namjaejeon committed Jul 3, 2020
1 parent d7fd859 commit 9cbc7e4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion exfat_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,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 9cbc7e4

Please sign in to comment.