In r337271, we limited the sector number to the lower of calculated

number and CHS based number.  However, on some systems, BIOS would
report 0 in CHS fields, making the system to think there is 0 sectors.

Add a check before comparing the calculated total with bd_sectors.

Reviewed by:	tsoome, cy
Differential Revision:	https://reviews.freebsd.org/D16577
This commit is contained in:
Xin LI 2018-08-04 14:13:09 +00:00
parent 54c531cacd
commit 3848ff5cac

View File

@ -275,7 +275,7 @@ bd_int13probe(struct bdinfo *bd)
total = (uint64_t)params.cylinders *
params.heads * params.sectors_per_track;
if (bd->bd_sectors > total)
if (total > 0 && bd->bd_sectors > total)
bd->bd_sectors = total;
ret = 1;