From 03aa12a9fdba0ba94e6c18386d203471a5f23514 Mon Sep 17 00:00:00 2001 From: Yuezhang Mo Date: Wed, 24 Aug 2022 08:20:34 +0900 Subject: [PATCH] exfat: fix overflow for large capacity partition Using int type for sector index, there will be overflow in a large capacity partition. For example, if storage with sector size of 512 bytes and partition capacity is larger than 2TB, there will be overflow. Fixes: 1b6138385499 ("exfat: reduce block requests when zeroing a cluster") Signed-off-by: Yuezhang Mo Reviewed-by: Andy Wu Reviewed-by: Aoyama Wataru Acked-by: Sungjong Seo Signed-off-by: Namjae Jeon --- fatent.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fatent.c b/fatent.c index 8c073c33543c..ded465bcf84b 100644 --- a/fatent.c +++ b/fatent.c @@ -278,8 +278,7 @@ int exfat_zeroed_cluster(struct inode *dir, unsigned int clu) struct super_block *sb = dir->i_sb; struct exfat_sb_info *sbi = EXFAT_SB(sb); struct buffer_head *bh; - sector_t blknr, last_blknr; - int i; + sector_t blknr, last_blknr, i; blknr = exfat_cluster_to_sector(sbi, clu); last_blknr = blknr + sbi->sect_per_clus;