diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2009-04-10 20:55:57 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2009-04-10 20:55:57 +0000 |
commit | 9a7e70a9f10aa811e2cd4cf94dcda3e4cd42903d (patch) | |
tree | bc42c5def2ce2c50099d13154c7a8dc25fdad2b1 | |
parent | 0c071e02e2f0c9f5a71d1db3e1a44348594db00c (diff) |
Don't blindly dereference a NULL pointer when the boot device is not known.
-rw-r--r-- | sys/arch/solbourne/solbourne/autoconf.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/arch/solbourne/solbourne/autoconf.c b/sys/arch/solbourne/solbourne/autoconf.c index eda9abd4fc5..4cf93eddd44 100644 --- a/sys/arch/solbourne/solbourne/autoconf.c +++ b/sys/arch/solbourne/solbourne/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.9 2008/03/23 17:05:41 deraadt Exp $ */ +/* $OpenBSD: autoconf.c,v 1.10 2009/04/10 20:55:56 miod Exp $ */ /* OpenBSD: autoconf.c,v 1.64 2005/03/23 17:10:24 miod Exp */ /* @@ -140,7 +140,7 @@ bootstrap() asize += (1 + nenv) * sizeof(const char *); /* - * Setup the intial mappings. + * Setup the initial mappings. */ pmap_bootstrap(asize); @@ -318,6 +318,7 @@ diskconf(void) { struct bootpath *bp; struct device *bootdv; + int bootpart; /* * Configure swap area and related system @@ -325,8 +326,9 @@ diskconf(void) */ bp = nbootpath == 0 ? NULL : &bootpath[nbootpath-1]; bootdv = (bp == NULL) ? NULL : bp->dev; + bootpart = (bp == NULL) ? 0 : bp->val[2]; - setroot(bootdv, bp->val[2], RB_USERREQ | RB_HALT); + setroot(bootdv, bootpart, RB_USERREQ | RB_HALT); dumpconf(); } |