9699 loader: biosdisk should prefer smaller (safer) sectors value from INT13
Reviewed by: Andy Fiddaman <omnios@citrus-it.co.uk>
Reviewed by: Yuri Pankov <yuripv@yuripv.net>
Approved by: Robert Mustacchi <rm@joyent.com>
diff --git a/usr/src/boot/sys/boot/i386/libi386/biosdisk.c b/usr/src/boot/sys/boot/i386/libi386/biosdisk.c
index 6218465..598cef6 100644
--- a/usr/src/boot/sys/boot/i386/libi386/biosdisk.c
+++ b/usr/src/boot/sys/boot/i386/libi386/biosdisk.c
@@ -269,7 +269,7 @@
 
 		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;