From nobody@FreeBSD.org  Tue Jun 19 08:41:29 2007
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id D59F916A46B
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 19 Jun 2007 08:41:29 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [69.147.83.33])
	by mx1.freebsd.org (Postfix) with ESMTP id C83BA13C484
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 19 Jun 2007 08:41:29 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id l5J8fTvh038173
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 19 Jun 2007 08:41:29 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id l5J8fTQv038172;
	Tue, 19 Jun 2007 08:41:29 GMT
	(envelope-from nobody)
Message-Id: <200706190841.l5J8fTQv038172@www.freebsd.org>
Date: Tue, 19 Jun 2007 08:41:29 GMT
From: Cedric GROSS <cedric.gross@cnv.fr>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [libdisk][patch] Correction of Sanitize_Bios_Geom for large disk
X-Send-Pr-Version: www-3.0

>Number:         113849
>Category:       kern
>Synopsis:       [libdisk] [patch] Correction of Sanitize_Bios_Geom for large disk
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun 19 08:50:03 GMT 2007
>Closed-Date:    
>Last-Modified:  Wed Jan 14 20:38:42 UTC 2009
>Originator:     Cedric GROSS
>Release:        6.2-Release
>Organization:
CNV
>Environment:
FreeBSD prt-freebsd.cnv.local 6.2-RELEASE-p5 FreeBSD 6.2-RELEASE-p5 #1: Mon Jun 18 18:01:30 CEST 2007     root@prt-freebsd.cnv.local:/usr/obj/usr/src/sys/VIRT  i386
>Description:
Sanitize_Bios_Geom check for cylindre/head/sector with old values and use cylindre up to 65535 anyway.


>How-To-Repeat:
Use HDD larger than 32Gb
>Fix:
Adjust condition as for PC98, see also PR bin/113682 to adjust sysinstall


Patch attached with submission follows:

--- src/lib/libdisk/change.c.origin	Wed Mar 30 15:03:33 2005
+++ src/lib/libdisk/change.c	Tue Jun 19 10:15:58 2007
@@ -34,23 +34,11 @@
 
 	sane = 1;
 
-#ifdef PC98
 	if (disk->bios_cyl >= 65536)
-#else
-	if (disk->bios_cyl > 1024)
-#endif
 		sane = 0;
-#ifdef PC98
 	if (disk->bios_hd >= 256)
-#else
-	if (disk->bios_hd > 16)
-#endif
 		sane = 0;
-#ifdef PC98
 	if (disk->bios_sect >= 256)
-#else
-	if (disk->bios_sect > 63)
-#endif
 		sane = 0;
 	if (disk->bios_cyl * disk->bios_hd * disk->bios_sect !=
 	    disk->chunks->size)
@@ -64,11 +52,7 @@
 	disk->bios_cyl = disk->chunks->size /
 		(disk->bios_sect * disk->bios_hd);
 
-#ifdef PC98
 	if (disk->bios_cyl < 65536)
-#else
-	if (disk->bios_cyl < 1024)
-#endif
 		return;
 
 	/* Hmm, try harder... */
@@ -82,7 +66,6 @@
 	disk->bios_cyl = disk->chunks->size /
 		(disk->bios_sect * disk->bios_hd);
 
-#ifdef PC98
 	if (disk->bios_cyl < 65536)
 		return;
 
@@ -99,7 +82,8 @@
 	disk->bios_hd = 255;
 	disk->bios_cyl = disk->chunks->size /
 		(disk->bios_sect * disk->bios_hd);
-#endif
+
+	/* should be ok with head=255 and sector=255 */
 }
 
 void


>Release-Note:
>Audit-Trail:
>Unformatted:
