Date: Sat, 10 Aug 2024 11:37:20 +0200 (CEST) From: Ronald Klop <ronald-lists@klop.ws> To: =?UTF-8?Q?Stefan_E=C3=9Fer?= <se@FreeBSD.org> Cc: dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: git: 45d4e82bf61f - main - msdosfs: fix cluster limit when mounting FAT-16 file systems Message-ID: <1288204472.10012.1723282640878@localhost> In-Reply-To: <202408091733.479HX3Wx000151@gitrepo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] Van: "Stefan Eßer" <se@FreeBSD.org> Datum: 9 augustus 2024 19:33 Aan: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Onderwerp: git: 45d4e82bf61f - main - msdosfs: fix cluster limit when mounting FAT-16 file systems > > > 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 " > > > > > Hi, Isn’t this similar? And a little bit shorter. clusters = MIN(clusters, CLUST_RSRVD & pmp->pm_fatmask); Regards,Ronald [-- Attachment #2 --] <html><head></head><body><br><p><small><strong>Van:</strong> "Stefan Eßer" <se@FreeBSD.org><br><strong>Datum:</strong> 9 augustus 2024 19:33<br><strong>Aan:</strong> src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org<br><strong>Onderwerp:</strong> git: 45d4e82bf61f - main - msdosfs: fix cluster limit when mounting FAT-16 file systems<br></small></p><blockquote style="margin-left: 5px; border-left: 3px solid #ccc; margin-right: 0px; padding-left: 5px;"><div class="MessageRFC822Viewer" id="P"><!-- P --> <!-- processMimeMessage --><div class="TextPlainViewer" id="P.P"><!-- P.P -->The branch main has been updated by se:<br> <br> URL: <a href="https://cgit.FreeBSD.org/src/commit/?id=45d4e82bf61f91792142a2b9e2af657dab8500fd">https://cgit.FreeBSD.org/src/commit/?id=45d4e82bf61f91792142a2b9e2af657dab8500fd</a><br> <br> commit 45d4e82bf61f91792142a2b9e2af657dab8500fd<br> Author: Stefan Eßer <se@freebsd.org><br> AuthorDate: 2024-08-09 17:26:27 +0000<br> Commit: Stefan Eßer <se@freebsd.org><br> CommitDate: 2024-08-09 17:26:27 +0000<br> <br> msdosfs: fix cluster limit when mounting FAT-16 file systems<br> <br> The maximum cluster number was calculated based on the number of data<br> cluters that fit in the givem partition size and the size of the FAT<br> area. This limit did not take into account that the highest 10 cluster<br> numbers are reserved and must not be used for files.<br> <br> PR: 280347<br> MFC after: 3 days<br> Reported by: pho@FreeBSD.org<br> ---<br> sys/fs/msdosfs/msdosfs_vfsops.c | 4 +++-<br> 1 file changed, 3 insertions(+), 1 deletion(-)<br> <br> diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c<br> index 258c701bd300..adcffe45df82 100644<br> --- a/sys/fs/msdosfs/msdosfs_vfsops.c<br> +++ b/sys/fs/msdosfs/msdosfs_vfsops.c<br> @@ -722,7 +722,9 @@ mountmsdosfs(struct vnode *odevvp, struct mount *mp)<br> }<br> }<br> <br> - clusters = (pmp->pm_fatsize / pmp->pm_fatmult) * pmp->pm_fatdiv ;<br> + clusters = (pmp->pm_fatsize / pmp->pm_fatmult) * pmp->pm_fatdiv;<br> + if (clusters >= (CLUST_RSRVD & pmp->pm_fatmask))<br> + clusters = CLUST_RSRVD & pmp->pm_fatmask;<br> if (pmp->pm_maxcluster >= clusters) {<br> #ifdef MSDOSFS_DEBUG<br> printf("Warning: number of clusters (%ld) exceeds FAT "<br> <br> </se@freebsd.org></se@freebsd.org></div><!-- TextPlainViewer --> <hr> </div><!-- MessageRFC822Viewer --> </blockquote><br><br>Hi,<br class="rw_extra"><br>Isn’t this similar? And a little bit shorter. <br class="rw_extra"><br>clusters = MIN(clusters, <span style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.3); -webkit-text-size-adjust: auto;">CLUST_RSRVD & pmp->pm_fatmask);</span><br><br>Regards,<br class="rw_extra">Ronald<br class="rw_extra"><br></body></html>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1288204472.10012.1723282640878>
