Module Name: src
Committed By: jdc
Date: Sun Jun 24 16:17:40 UTC 2012
Modified Files:
src/sys/arch/i386/stand/lib [netbsd-6]: biosdisk.c
Log Message:
Pull up revision 1.41 (requested by martin in ticket #349).
Sanity check the values coming back from the int13 extensions of the bios,
so we can catch impossible return values. Allows the bootloader to work
again on the Soekris net4501.
Fixes PR kern/46027.
To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.40.2.1 src/sys/arch/i386/stand/lib/biosdisk.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/i386/stand/lib/biosdisk.c
diff -u src/sys/arch/i386/stand/lib/biosdisk.c:1.40 src/sys/arch/i386/stand/lib/biosdisk.c:1.40.2.1
--- src/sys/arch/i386/stand/lib/biosdisk.c:1.40 Mon Jan 16 18:47:57 2012
+++ src/sys/arch/i386/stand/lib/biosdisk.c Sun Jun 24 16:17:40 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: biosdisk.c,v 1.40 2012/01/16 18:47:57 christos Exp $ */
+/* $NetBSD: biosdisk.c,v 1.40.2.1 2012/06/24 16:17:40 jdc Exp $ */
/*
* Copyright (c) 1996, 1998
@@ -316,7 +316,9 @@ read_gpt(struct biosdisk *d)
gptsector[0] = GPT_HDR_BLKNO;
if (set_geometry(&d->ll, &ed) == 0 && d->ll.flags & BIOSDISK_INT13EXT) {
gptsector[1] = ed.totsec - 1;
- d->ll.secsize = ed.sbytes;
+ /* Sanity check values returned from BIOS */
+ if (ed.sbytes >= 512 && (ed.sbytes & (ed.sbytes - 1)) == 0)
+ d->ll.secsize = ed.sbytes;
} else {
#ifdef DISK_DEBUG
printf("Unable to determine extended disk geometry - "