fs/msdosfs fatblock: use ulmin() rather than min()

to avoid truncation of pmp->pm_FATsecs.

Submitted by:	Robert Morris <rtm@lcs.mit.edu>
PR:	277237
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2024-02-23 19:30:10 +02:00
parent 3db693f7da
commit 0085afdceb

View File

@ -97,7 +97,7 @@ fatblock(struct msdosfsmount *pmp, u_long ofs, u_long *bnp, u_long *sizep,
fatblocksec /= 2;
}
bn = ofs / pmp->pm_fatblocksize * pmp->pm_fatblocksec;
size = roundup(min(fatblocksec, pmp->pm_FATsecs - bn) * DEV_BSIZE,
size = roundup(ulmin(fatblocksec, pmp->pm_FATsecs - bn) * DEV_BSIZE,
pmp->pm_BlkPerSec * DEV_BSIZE);
bn += pmp->pm_fatblk + pmp->pm_curfat * pmp->pm_FATsecs;