From nobody Sat Aug 10 09:37:20 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 4Wgwfq1gTtz5SQpm; Sat, 10 Aug 2024 09:37:23 +0000 (UTC) (envelope-from SRS0=RDIa=PJ=klop.ws=ronald-lists@realworks.nl) Received: from smtp-relay-int.realworks.nl (smtp-relay-int.realworks.nl [194.109.157.24]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4Wgwfp6QVwz4l7Y; Sat, 10 Aug 2024 09:37:22 +0000 (UTC) (envelope-from SRS0=RDIa=PJ=klop.ws=ronald-lists@realworks.nl) Authentication-Results: mx1.freebsd.org; none Date: Sat, 10 Aug 2024 11:37:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=klop.ws; s=rw2; t=1723282641; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to; bh=08Dsb6lopGAC0HJTDhFmTjSbs2on/9wOEvkZydwjl2Q=; b=DVLGldu2x6LE5CCBXchlumhwukfY+Q5cUUWOyH5pb/EWMH/Xc7iW92tRIlScKuzrtz0nD/ 15n7+mti2JdXTLkGz0AJvAu9Ey5AJlZ78EYDW3EayCUBXSIn3uEGut6j00ZcomYD8XJ2o/ G5bVGSQkG5k48ZNKyiJsIiwd6h8dQDVsH0WK2KlofFAibWZuSoHxVpW8hn+Sy1ozgrxBdL jWYCyOp1sfxFy08WP1bn2XEiL9G/gsmEbF6YYUG2ci4zjmBeJDtIXM6/JJ4KT5Kt09qIBq sS5uzsgMijk7Z4LNV766f0KHBwdsFATy3lCTjtEq04ig/L4FoMFTyY8rSGkAJg== From: Ronald Klop To: =?UTF-8?Q?Stefan_E=C3=9Fer?= Cc: dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org, src-committers@FreeBSD.org Message-ID: <1288204472.10012.1723282640878@localhost> In-Reply-To: <202408091733.479HX3Wx000151@gitrepo.freebsd.org> Subject: Re: 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: multipart/alternative; boundary="----=_Part_10011_405453788.1723282640875" X-Mailer: Realworks (715.28) Importance: Normal X-Priority: 3 (Normal) X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:3265, ipnet:194.109.0.0/16, country:NL] X-Rspamd-Queue-Id: 4Wgwfp6QVwz4l7Y ------=_Part_10011_405453788.1723282640875 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Van: "Stefan E=C3=9Fer" Datum: 9 augustus 2024 19:33 Aan: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commi= ts-src-main@FreeBSD.org Onderwerp: git: 45d4e82bf61f - main - msdosfs: fix cluster limit when moun= ting FAT-16 file systems >=20 >=20 > The branch main has been updated by se: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3D45d4e82bf61f91792142a2b9e2= af657dab8500fd >=20 > commit 45d4e82bf61f91792142a2b9e2af657dab8500fd > Author: Stefan E=C3=9Fer=20 > AuthorDate: 2024-08-09 17:26:27 +0000 > Commit: Stefan E=C3=9Fer=20 > CommitDate: 2024-08-09 17:26:27 +0000 >=20 > msdosfs: fix cluster limit when mounting FAT-16 file systems > =20 > 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 cluste= r > numbers are reserved and must not be used for files. > =20 > 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(-) >=20 > diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfs= ops.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) > } > } > =20 > - clusters =3D (pmp->pm_fatsize / pmp->pm_fatmult) * pmp->pm_fatdiv ; > + clusters =3D (pmp->pm_fatsize / pmp->pm_fatmult) * pmp->pm_fatdiv; > + if (clusters >=3D (CLUST_RSRVD & pmp->pm_fatmask)) > + clusters =3D CLUST_RSRVD & pmp->pm_fatmask; > if (pmp->pm_maxcluster >=3D clusters) { > #ifdef MSDOSFS_DEBUG > printf("Warning: number of clusters (%ld) exceeds FAT " >=20 >=20 >=20 >=20 >=20 Hi, Isn=E2=80=99t this similar? And a little bit shorter.=20 clusters =3D MIN(clusters, CLUST_RSRVD & pmp->pm_fatmask); Regards,Ronald ------=_Part_10011_405453788.1723282640875 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable

Van: "Stefan E=C3= =9Fer" <se@FreeBSD.org>
Datum: 9 augustus 2024 19= :33
Aan: src-committers@FreeBSD.org, dev-commits-src-al= l@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Onderwerp: git: 45d4e82bf61f - main - msdosfs: fix cluster limit when mounting FA= T-16 file systems

The branch main has been updated by se:

URL: https://cgit.FreeBSD.org/src/commit/?id=3D45d4e82b= f61f91792142a2b9e2af657dab8500fd

commit 45d4e82bf61f91792142a2b9e2af657dab8500fd
Author:     Stefan E=C3=9Fer
AuthorDate: 2024-08-09 17:26:27 +0000
Commit:     Stefan E=C3=9Fer
CommitDate: 2024-08-09 17:26:27 +0000

    msdosfs: fix cluster limit when mounting FAT-16 fil= e systems
    
    The maximum cluster number was calculated based on = the number of data
    cluters that fit in the givem partition size and th= e 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_vfsop= s.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 =3D (pmp->pm_fatsize / pmp->pm_fatmult) * pmp-= >pm_fatdiv ;
+   clusters =3D (pmp->pm_fatsize / pmp->pm_fatmult) * pmp-= >pm_fatdiv;
+   if (clusters >=3D (CLUST_RSRVD & pmp->pm_fatmask))<= br> +       clusters =3D CLUST_RSRVD & pmp-&g= t;pm_fatmask;
    if (pmp->pm_maxcluster >=3D clusters) {
 #ifdef MSDOSFS_DEBUG
        printf("Warning: number of = clusters (%ld) exceeds FAT "




Hi,

Isn=E2=80=99t this simil= ar? And a little bit shorter. 

clusters =3D = MIN(clusters, CLUST_RSRVD & pmp->pm_fa= tmask);

Regards,
Ronald

------=_Part_10011_405453788.1723282640875--