Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sysinst Deal with partitioning schemes having no in...



details:   https://anonhg.NetBSD.org/src/rev/d8743633be6a
branches:  trunk
changeset: 744557:d8743633be6a
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Feb 06 11:55:18 2020 +0000

description:
Deal with partitioning schemes having no inner counterpart.
Avoid NULL derefs.

diffstat:

 usr.sbin/sysinst/partman.c |  16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diffs (39 lines):

diff -r f92417b0f513 -r d8743633be6a usr.sbin/sysinst/partman.c
--- a/usr.sbin/sysinst/partman.c        Thu Feb 06 11:46:35 2020 +0000
+++ b/usr.sbin/sysinst/partman.c        Thu Feb 06 11:55:18 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: partman.c,v 1.49 2020/01/27 21:21:22 martin Exp $ */
+/*     $NetBSD: partman.c,v 1.50 2020/02/06 11:55:18 martin Exp $ */
 
 /*
  * Copyright 2012 Eugene Lozovoy
@@ -3249,7 +3249,7 @@
 {
        struct pm_devs *my_pm = pm_from_pe(pe);
        struct partition_usage_set pset = { 0 };
-       struct disk_partitions *parts;
+       struct disk_partitions *parts, *np;
 
        if (!my_pm)
                return;
@@ -3264,12 +3264,16 @@
        if (my_pm->parts->pscheme->secondary_scheme != NULL) {
                if (!edit_outer_parts(my_pm->parts))
                        goto done;
-               parts = get_inner_parts(parts);
+               np = get_inner_parts(parts);
+               if (np != NULL)
+                       parts = np;
        }
 
-       usage_set_from_parts(&pset, parts);
-       edit_and_check_label(my_pm, &pset, false);
-       free_usage_set(&pset);
+       if (parts != NULL) {
+               usage_set_from_parts(&pset, parts);
+               edit_and_check_label(my_pm, &pset, false);
+               free_usage_set(&pset);
+       }
 
 done:
        pm_partusage(my_pm, -1, -1);



Home | Main Index | Thread Index | Old Index