The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=269002da453895fc935101afefeb02d2c7d10360
commit 269002da453895fc935101afefeb02d2c7d10360 Author: Yunheeee <[email protected]> AuthorDate: 2026-09-26 03:10:04 +0000 Commit: Xin LI <[email protected]> CommitDate: 2026-09-26 03:10:04 +0000 fsck_msdosfs: fix head bitmap over-allocation on 32-bit platforms bitmap_ctor() computed the allocation size as roundup2(bits, LONG_BIT) / (LONG_BIT / 8) The dividend is a count of bits, so converting it to bytes requires dividing by 8 (bits per byte), not by LONG_BIT / 8 (bytes per long). The two divisors happen to coincide on LP64, but on ILP32 platforms the head bitmap was allocated at twice the required size; for a FAT32 file system with close to 2^28 clusters, that is 64 MiB instead of 32 MiB. The extra half of the allocation was never accessed, so there is no functional change other than the reduced memory footprint. MFC after: 3 days Pull Request: https://github.com/freebsd/freebsd-src/pull/2440 --- sbin/fsck_msdosfs/fat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/fsck_msdosfs/fat.c b/sbin/fsck_msdosfs/fat.c index 7d0ad9a595cf..ef788c9826a4 100644 --- a/sbin/fsck_msdosfs/fat.c +++ b/sbin/fsck_msdosfs/fat.c @@ -121,7 +121,7 @@ bitmap_count(long_bitmap_t *lbp) static int bitmap_ctor(long_bitmap_t *lbp, size_t bits, bool allone) { - size_t bitmap_size = roundup2(bits, LONG_BIT) / (LONG_BIT / 8); + size_t bitmap_size = roundup2(bits, LONG_BIT) / 8; free(lbp->map); lbp->map = calloc(1, bitmap_size);
