From nobody Fri Aug 09 17:33:03 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WgWG75zmKz5SV0m; Fri, 09 Aug 2024 17:33:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WgWG755Lgz45Bd; Fri, 9 Aug 2024 17:33:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723224783; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BYWDIz28jvsferXWezSm4xisX3rBaCEPTkPMSBglKWw=; b=iWorPspTsigcY7qDLp01Ml10AxNkvgiIWx6IeXWKMOcyy7JAuHSJeKwqaHq//GMjDEI4i7 /GuXqSdGH1x6Gy5k+za8GyucXsQTPWhzIq1Y+D8+pYlrgqgkmmkAC9YY0dbnU5EiQrxvT9 4DU/9SCz4Cb/P0EIJiny/2ebK8GqOKjrU+bEQyYNaMaFy+FrATjRdiy1Vfh3kfUKROsNKu y/YJQrVdV4jVzaidsQxdHFWmCvkwmwsYEgqup1tp1ye6psTEdssx6tHwsfQYZEGwlrmlEM 5wdPqKz3vd5QNfxFWKWSqm2J5b26kHB/+lj/3F5dy31BenF898shfsxs+D2Lcw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1723224783; a=rsa-sha256; cv=none; b=P9zk36yT8SiyDO7KsssSLpP3zOl4zSq7r9qWERTmpJPR8LkqBjH1mB6p+ihz7ml+frMU29 /VpszoxhOkP+Vs0B05nNo/AzLbJULRMmZ2xsbsoZubeTtSUGOBGI0ZPryGYh0csAhahRnf OaDbylzSMzvpnpdgEuqzYgZifsigDQldL22iQ292mW3J2z9bNo/2pywTYZYW/F/Atu5xUl QlLyR9yer07flx6hcOUh1GI49ZBVGNa4ClXN3zbbeP71UpaDOn8dIvD/q8WiRaI9/w5gxF G73TInt0mcdCNlMLckkZw7E/4dJ6IWoYcbTWin+7c81X4VwUsu94fp38M+BmgA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723224783; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BYWDIz28jvsferXWezSm4xisX3rBaCEPTkPMSBglKWw=; b=EK8sut87wtTVXsMHbnuV5WbHaEq0lrfybqJRn++5ltw+mZSLXZmDdVwJp3GEV0rm9o4o4B 4ezFQBA7yeWy9pG63y1SXRZqGf8ZZYMJZDPjMESFQAU9CJzoLtdplQGKGs4JODHfx8I/SM ZnvKKPu+50jVZpoUy3jiHN/rZK4ARgQxEed6AGBm7LKAR75WywaWT5isGdjAGuQtL9Mj3Z Y+X3dlhesaDqyW/xo4Whl6ObHNiJM0JB3u0Yk/ShQ7vIgVTpNTEyu32VJz98BOv4HfP7v7 mjSsNrpbM52Gw8QDMvBQobd/NMczkL3OtMyChezz9osaIDAfaoOFaUymbIUnbQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WgWG74hK6zQj7; Fri, 9 Aug 2024 17:33:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 479HX3Dw000154; Fri, 9 Aug 2024 17:33:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 479HX3Wx000151; Fri, 9 Aug 2024 17:33:03 GMT (envelope-from git) Date: Fri, 9 Aug 2024 17:33:03 GMT Message-Id: <202408091733.479HX3Wx000151@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Stefan =?utf-8?Q?E=C3=9Fer?= Subject: git: 45d4e82bf61f - main - msdosfs: fix cluster limit when mounting FAT-16 file systems List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 45d4e82bf61f91792142a2b9e2af657dab8500fd Auto-Submitted: auto-generated The branch main has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=45d4e82bf61f91792142a2b9e2af657dab8500fd commit 45d4e82bf61f91792142a2b9e2af657dab8500fd Author: Stefan Eßer AuthorDate: 2024-08-09 17:26:27 +0000 Commit: Stefan Eßer CommitDate: 2024-08-09 17:26:27 +0000 msdosfs: fix cluster limit when mounting FAT-16 file systems The maximum cluster number was calculated based on the number of data cluters that fit in the givem partition size and the size of the FAT area. This limit did not take into account that the highest 10 cluster numbers are reserved and must not be used for files. PR: 280347 MFC after: 3 days Reported by: pho@FreeBSD.org --- sys/fs/msdosfs/msdosfs_vfsops.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c index 258c701bd300..adcffe45df82 100644 --- a/sys/fs/msdosfs/msdosfs_vfsops.c +++ b/sys/fs/msdosfs/msdosfs_vfsops.c @@ -722,7 +722,9 @@ mountmsdosfs(struct vnode *odevvp, struct mount *mp) } } - clusters = (pmp->pm_fatsize / pmp->pm_fatmult) * pmp->pm_fatdiv ; + clusters = (pmp->pm_fatsize / pmp->pm_fatmult) * pmp->pm_fatdiv; + if (clusters >= (CLUST_RSRVD & pmp->pm_fatmask)) + clusters = CLUST_RSRVD & pmp->pm_fatmask; if (pmp->pm_maxcluster >= clusters) { #ifdef MSDOSFS_DEBUG printf("Warning: number of clusters (%ld) exceeds FAT "