Van: "Stefan Eßer" <[email protected]>
Datum: 9 augustus 2024 19:33
Aan: [email protected], [email protected],
[email protected]
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: [email protected]
---
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