From bf0d940a2f48022204b3de50c6aca9993fc40527 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Tue, 30 Aug 2016 18:01:26 +0000 Subject: [PATCH] The code only converts from bpbHugeSectors to bpbSectors if the sum of the hidden and huge sectors is less than or equal MAXU16. When formatting in Windows bpbSectors is still used for 63488 sectors and 2048 hidden (sum > MAXU16). The hidden sectors count is the number of sectors before the FAT16 Boot Record so it shouldn't affect the sector count. Attached patch (huge_sec_conversion.patch) to only check for bpb.bpbHugeSectors <= MAXU16 when converting to bpbSectors. Submitted by: Guy Yur PR: 183234 --- sbin/newfs_msdos/mkfs_msdos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/newfs_msdos/mkfs_msdos.c b/sbin/newfs_msdos/mkfs_msdos.c index f29760f7f25..b961e25c431 100644 --- a/sbin/newfs_msdos/mkfs_msdos.c +++ b/sbin/newfs_msdos/mkfs_msdos.c @@ -556,7 +556,7 @@ mkfs_msdos(const char *fname, const char *dtype, const struct msdos_options *op) bpb.bpbMedia = !bpb.bpbHiddenSecs ? 0xf0 : 0xf8; if (fat == 32) bpb.bpbRootClust = RESFTE; - if (bpb.bpbHiddenSecs + bpb.bpbHugeSectors <= MAXU16) { + if (bpb.bpbHugeSectors <= MAXU16) { bpb.bpbSectors = bpb.bpbHugeSectors; bpb.bpbHugeSectors = 0; }