Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-6]: src/sys/arch/i386/stand/lib Pull up revision 1.41 (requested ...



details:   https://anonhg.NetBSD.org/src/rev/256790a44d18
branches:  netbsd-6
changeset: 774246:256790a44d18
user:      jdc <jdc%NetBSD.org@localhost>
date:      Sun Jun 24 16:17:40 2012 +0000

description:
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.

diffstat:

 sys/arch/i386/stand/lib/biosdisk.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (20 lines):

diff -r b1500764ce94 -r 256790a44d18 sys/arch/i386/stand/lib/biosdisk.c
--- a/sys/arch/i386/stand/lib/biosdisk.c        Sun Jun 24 16:11:24 2012 +0000
+++ b/sys/arch/i386/stand/lib/biosdisk.c        Sun Jun 24 16:17:40 2012 +0000
@@ -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 @@
        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 - "



Home | Main Index | Thread Index | Old Index