Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sysinst If a fictious label has no RAW_PART assume ...



details:   https://anonhg.NetBSD.org/src/rev/269da87a6e17
branches:  trunk
changeset: 967572:269da87a6e17
user:      martin <martin%NetBSD.org@localhost>
date:      Sat Dec 14 19:26:17 2019 +0000

description:
If a fictious label has no RAW_PART assume there is no valid disk label.

diffstat:

 usr.sbin/sysinst/disklabel.c |  7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diffs (28 lines):

diff -r d973db129a08 -r 269da87a6e17 usr.sbin/sysinst/disklabel.c
--- a/usr.sbin/sysinst/disklabel.c      Sat Dec 14 17:31:53 2019 +0000
+++ b/usr.sbin/sysinst/disklabel.c      Sat Dec 14 19:26:17 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disklabel.c,v 1.23 2019/12/13 22:12:41 martin Exp $    */
+/*     $NetBSD: disklabel.c,v 1.24 2019/12/14 19:26:17 martin Exp $    */
 
 /*
  * Copyright 2018 The NetBSD Foundation, Inc.
@@ -270,6 +270,10 @@
        if (!have_raw_label && !only_dl) {
                bool found_real_part = false;
 
+               if (parts->l.d_npartitions <= RAW_PART ||
+                   parts->l.d_partitions[RAW_PART].p_size == 0)
+                       goto no_valid_label;
+
                /*
                 * Check if kernel translation gave us "something" besides
                 * the raw or the whole-disk partition.
@@ -291,6 +295,7 @@
                }
                if (!found_real_part) {
                        /* no partion there yet */
+no_valid_label:
                        free(parts);
                        return NULL;
                }



Home | Main Index | Thread Index | Old Index