Source-Changes-HG archive

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

[src/trunk]: src/sys/kern If the MBR is a protective MBR, don't bother lookin...



details:   https://anonhg.NetBSD.org/src/rev/f56cf5eb20b9
branches:  trunk
changeset: 787618:f56cf5eb20b9
user:      matt <matt%NetBSD.org@localhost>
date:      Wed Jun 26 18:47:26 2013 +0000

description:
If the MBR is a protective MBR, don't bother looking at it.

diffstat:

 sys/kern/subr_disk_mbr.c |  13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r 60d59d6f7190 -r f56cf5eb20b9 sys/kern/subr_disk_mbr.c
--- a/sys/kern/subr_disk_mbr.c  Wed Jun 26 17:55:38 2013 +0000
+++ b/sys/kern/subr_disk_mbr.c  Wed Jun 26 18:47:26 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_disk_mbr.c,v 1.45 2012/10/03 07:05:51 mlelstv Exp $       */
+/*     $NetBSD: subr_disk_mbr.c,v 1.46 2013/06/26 18:47:26 matt Exp $  */
 
 /*
  * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@@ -54,7 +54,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_disk_mbr.c,v 1.45 2012/10/03 07:05:51 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_disk_mbr.c,v 1.46 2013/06/26 18:47:26 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -160,6 +160,15 @@
                if (mbr->mbr_magic != htole16(MBR_MAGIC))
                        return SCAN_CONTINUE;
 
+               /*
+                * If this is a protective MBR, bail now.
+                */
+               if (mbr->mbr_parts[0].mbrp_type == MBR_PTYPE_PMBR
+                   && mbr->mbr_parts[1].mbrp_type == MBR_PTYPE_UNUSED
+                   && mbr->mbr_parts[2].mbrp_type == MBR_PTYPE_UNUSED
+                   && mbr->mbr_parts[3].mbrp_type == MBR_PTYPE_UNUSED)
+                       return SCAN_CONTINUE;
+
                /* Copy data out of buffer so action can use bp */
                memcpy(ptns, &mbr->mbr_parts, sizeof ptns);
 



Home | Main Index | Thread Index | Old Index