[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221224013127.393187-13-sashal@kernel.org>
Date: Fri, 23 Dec 2022 20:31:26 -0500
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
Cc: Yuezhang Mo <Yuezhang.Mo@...y.com>,
Sungjong Seo <sj1557.seo@...sung.com>,
Namjae Jeon <linkinjeon@...nel.org>,
Sasha Levin <sashal@...nel.org>, linux-fsdevel@...r.kernel.org
Subject: [PATCH AUTOSEL 5.15 13/14] exfat: fix overflow in sector and cluster conversion
From: Yuezhang Mo <Yuezhang.Mo@...y.com>
[ Upstream commit 40306b4d1ba25970dafd53432e8daa5d591ebd99 ]
According to the exFAT specification, there are at most 2^32-11
clusters in a volume. so using 'int' is not enough for cluster
index, the return value type of exfat_sector_to_cluster() should
be 'unsigned int'.
Signed-off-by: Yuezhang Mo <Yuezhang.Mo@...y.com>
Reviewed-by: Sungjong Seo <sj1557.seo@...sung.com>
Signed-off-by: Namjae Jeon <linkinjeon@...nel.org>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
fs/exfat/exfat_fs.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/exfat/exfat_fs.h b/fs/exfat/exfat_fs.h
index 9f82a8a835ee..d99df8d83d38 100644
--- a/fs/exfat/exfat_fs.h
+++ b/fs/exfat/exfat_fs.h
@@ -374,7 +374,7 @@ static inline sector_t exfat_cluster_to_sector(struct exfat_sb_info *sbi,
sbi->data_start_sector;
}
-static inline int exfat_sector_to_cluster(struct exfat_sb_info *sbi,
+static inline unsigned int exfat_sector_to_cluster(struct exfat_sb_info *sbi,
sector_t sec)
{
return ((sec - sbi->data_start_sector) >> sbi->sect_per_clus_bits) +
--
2.35.1
Powered by blists - more mailing lists