Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sysinst PR 56310: avoid assert() failures (or crash...



details:   https://anonhg.NetBSD.org/src/rev/057a549961ac
branches:  trunk
changeset: 1022422:057a549961ac
user:      martin <martin%NetBSD.org@localhost>
date:      Sat Jul 17 11:32:50 2021 +0000

description:
PR 56310: avoid assert() failures (or crashes) when the runtime addition
of a wedge fails (for whatever reasons).

diffstat:

 usr.sbin/sysinst/gpt.c     |   9 ++++++---
 usr.sbin/sysinst/partman.c |  16 ++++++++--------
 2 files changed, 14 insertions(+), 11 deletions(-)

diffs (53 lines):

diff -r 07b703178193 -r 057a549961ac usr.sbin/sysinst/gpt.c
--- a/usr.sbin/sysinst/gpt.c    Sat Jul 17 10:45:58 2021 +0000
+++ b/usr.sbin/sysinst/gpt.c    Sat Jul 17 11:32:50 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gpt.c,v 1.23 2021/01/31 22:45:46 rillig Exp $  */
+/*     $NetBSD: gpt.c,v 1.24 2021/07/17 11:32:50 martin Exp $  */
 
 /*
  * Copyright 2018 The NetBSD Foundation, Inc.
@@ -1404,8 +1404,11 @@
                usage = plain_name;
        if (usage == plain_name || usage == raw_dev_name)
                life = true;
-       if (!(p->gp_flags & GPEF_WEDGE) && life)
-               gpt_add_wedge(arg->disk, p);
+       if (!(p->gp_flags & GPEF_WEDGE) && life &&
+           !gpt_add_wedge(arg->disk, p)) {
+               devname[0] = 0;
+               return false;
+       }
 
        switch (usage) {
        case logical_name:
diff -r 07b703178193 -r 057a549961ac usr.sbin/sysinst/partman.c
--- a/usr.sbin/sysinst/partman.c        Sat Jul 17 10:45:58 2021 +0000
+++ b/usr.sbin/sysinst/partman.c        Sat Jul 17 11:32:50 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: partman.c,v 1.51 2021/01/31 22:45:46 rillig Exp $ */
+/*     $NetBSD: partman.c,v 1.52 2021/07/17 11:32:50 martin Exp $ */
 
 /*
  * Copyright 2012 Eugene Lozovoy
@@ -2847,13 +2847,13 @@
                                dev_status);
                        break;
                case PM_PART:
-                       if (parts->pscheme->get_part_device != NULL)
-                               parts->pscheme->get_part_device(
-                                   parts,  part_num,
-                                   dev, sizeof dev, NULL, plain_name, false,
-                                   true);
-                       else
-                               strcpy(dev, "-");
+                       if (parts->pscheme->get_part_device == NULL ||
+                           !parts->pscheme->get_part_device(
+                               parts,  part_num,
+                               dev, sizeof dev, NULL, plain_name, false,
+                               true))
+                                       strcpy(dev, "-");
+
                        parts->pscheme->get_part_info(parts,
                            part_num, &info);
                        if (pm_cur->mounted != NULL &&



Home | Main Index | Thread Index | Old Index