[Bug 243178] newfs_msdos: wrong FAT type determination
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 17 May 2026 19:29:54 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=243178
--- Comment #4 from Damjan Jovanovic <damjan.jov@gmail.com> ---
newfs_msdos: 65503 clusters too few clusters for FAT32, need 65525
---snip---
593 if (cls < mincls(fat)) {
594 warnx("%u clusters too few clusters for FAT%u, need %u", cls,
fat,
595 mincls(fat));
596 goto done;
597 }
---snip---
so cls=65503, fat=32, mincls(fat)=65525.
---snip---
71 #define MINCLS12 1U /* minimum FAT12 clusters */
72 #define MINCLS16 0xff5U /* minimum FAT16 clusters */
73 #define MINCLS32 0xfff5U /* minimum FAT32 clusters */
74 #define MAXCLS12 0xff4U /* maximum FAT12 clusters */
75 #define MAXCLS16 0xfff4U /* maximum FAT16 clusters */
76 #define MAXCLS32 0xffffff4U /* maximum FAT32 clusters */
77
78 #define mincls(fat) ((fat) == 12 ? MINCLS12 : \
79 (fat) == 16 ? MINCLS16 : \
80 MINCLS32)
---snip---
Note how these form consecutive non-overlapping ranges:
0x1 - 0xff4|0xff5 - 0xfff4|0xfff5 - 0xffffff4
FAT12 | FAT16 | FAT32
So the wrong kind of FAT was chosen for that number of clusters, it should have
used FAT16, and when FAT16 is manually forced, it works.
--
You are receiving this mail because:
You are the assignee for the bug.