From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Yuezhang Mo <Yuezhang.Mo@sony.com>,
Sungjong Seo <sj1557.seo@samsung.com>,
Namjae Jeon <linkinjeon@kernel.org>,
Sasha Levin <sashal@kernel.org>,
linux-fsdevel@vger.kernel.org
Subject: [PATCH AUTOSEL 5.10 10/11] exfat: fix overflow in sector and cluster conversion
Date: Fri, 23 Dec 2022 20:32:00 -0500 [thread overview]
Message-ID: <20221224013202.393372-10-sashal@kernel.org> (raw)
In-Reply-To: <20221224013202.393372-1-sashal@kernel.org>
From: Yuezhang Mo <Yuezhang.Mo@sony.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@sony.com>
Reviewed-by: Sungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.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 0d139c7d150d..5c5ddd4e3a2f 100644
--- a/fs/exfat/exfat_fs.h
+++ b/fs/exfat/exfat_fs.h
@@ -373,7 +373,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
next prev parent reply other threads:[~2022-12-24 1:39 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-24 1:31 [PATCH AUTOSEL 5.10 01/11] kset: fix memory leak when kset_register() returns error Sasha Levin
2022-12-24 1:31 ` [PATCH AUTOSEL 5.10 02/11] USB: core: Change configuration warnings to notices Sasha Levin
2022-12-24 1:31 ` [PATCH AUTOSEL 5.10 03/11] usb: gadget: aspeed: fix buffer overflow Sasha Levin
2022-12-24 1:31 ` [PATCH AUTOSEL 5.10 04/11] usb: gadget: u_ether: Do not make UDC parent of the net device Sasha Levin
2022-12-24 1:31 ` [PATCH AUTOSEL 5.10 05/11] usb: gadget: f_ecm: Always set current gadget in ecm_bind() Sasha Levin
2022-12-24 1:31 ` [PATCH AUTOSEL 5.10 06/11] chardev: Fix potential memory leak when cdev_add() failed Sasha Levin
2022-12-24 1:31 ` [PATCH AUTOSEL 5.10 07/11] usb/usbip: Fix v_recv_cmd_submit() to use PIPE_BULK define Sasha Levin
2022-12-24 1:31 ` [PATCH AUTOSEL 5.10 08/11] xhci: disable U3 suspended ports in S4 hibernate poweroff_late stage Sasha Levin
2022-12-24 1:31 ` [PATCH AUTOSEL 5.10 09/11] ACPICA: Fix operand resolution Sasha Levin
2022-12-24 1:32 ` Sasha Levin [this message]
2022-12-24 1:32 ` [PATCH AUTOSEL 5.10 11/11] fbdev: smscufx: fix error handling code in ufx_usb_probe Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221224013202.393372-10-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=Yuezhang.Mo@sony.com \
--cc=linkinjeon@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sj1557.seo@samsung.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox