From 9cbc7e418ed0b89331b4af54b87197c5109e6f8e Mon Sep 17 00:00:00 2001 From: Namjae Jeon Date: Fri, 3 Jul 2020 08:10:27 +0900 Subject: [PATCH] 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 --- exfat_fs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exfat_fs.h b/exfat_fs.h index 60650f97673d..7cd72fb75ede 100644 --- a/exfat_fs.h +++ b/exfat_fs.h @@ -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; }