msdosfs: Fix mounting when the device sector size is >512B

HugeSectors * BytesPerSec should be computed before converting
HugeSectors to a DEV_BSIZE-based count.

Fixes:	ba2c98389b ("msdosfs: sanity check sector count from BPB")
Reviewed by:	kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34264
This commit is contained in:
Mark Johnston 2022-02-14 09:41:32 -05:00
parent 852ff943b9
commit c7cd607a4e

View File

@ -577,7 +577,6 @@ mountmsdosfs(struct vnode *odevvp, struct mount *mp)
goto error_exit;
}
pmp->pm_HugeSectors *= pmp->pm_BlkPerSec;
if ((off_t)pmp->pm_HugeSectors * pmp->pm_BytesPerSec <
pmp->pm_HugeSectors /* overflow */ ||
(off_t)pmp->pm_HugeSectors * pmp->pm_BytesPerSec >
@ -586,6 +585,7 @@ mountmsdosfs(struct vnode *odevvp, struct mount *mp)
goto error_exit;
}
pmp->pm_HugeSectors *= pmp->pm_BlkPerSec;
pmp->pm_HiddenSects *= pmp->pm_BlkPerSec; /* XXX not used? */
pmp->pm_FATsecs *= pmp->pm_BlkPerSec;
SecPerClust *= pmp->pm_BlkPerSec;