Source-Changes-HG archive

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

[src/trunk]: src/sys/kern don't crash if rootspec is invalid



details:   https://anonhg.NetBSD.org/src/rev/e050e1ca11a4
branches:  trunk
changeset: 333919:e050e1ca11a4
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sat Nov 22 10:24:02 2014 +0000

description:
don't crash if rootspec is invalid

diffstat:

 sys/kern/kern_subr.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 9a0ceecc8407 -r e050e1ca11a4 sys/kern/kern_subr.c
--- a/sys/kern/kern_subr.c      Sat Nov 22 06:45:08 2014 +0000
+++ b/sys/kern/kern_subr.c      Sat Nov 22 10:24:02 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_subr.c,v 1.214 2013/12/09 16:49:43 pooka Exp $    */
+/*     $NetBSD: kern_subr.c,v 1.215 2014/11/22 10:24:02 mlelstv Exp $  */
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2002, 2007, 2008 The NetBSD Foundation, Inc.
@@ -79,7 +79,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_subr.c,v 1.214 2013/12/09 16:49:43 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_subr.c,v 1.215 2014/11/22 10:24:02 mlelstv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_md.h"
@@ -422,7 +422,8 @@
                }
 
                if (rootdev == NODEV &&
-                   device_class(dv) == DV_DISK && device_is_a(dv, "dk") &&
+                   dv != NULL && device_class(dv) == DV_DISK &&
+                   device_is_a(dv, "dk") &&
                    (majdev = devsw_name2blk(device_xname(dv), NULL, 0)) >= 0)
                        rootdev = makedev(majdev, device_unit(dv));
 



Home | Main Index | Thread Index | Old Index