summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2014-11-24 16:40:30 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2014-11-24 16:40:30 +0000
commitb2fa0fc33b7c9e57ce5445400bf230a61e66b36a (patch)
treed47b4f0f6d78bb5cd9f69a3c74bcb26ea5e80cdf
parent2b17018f361bad06a9974e1ad452fc8e6653ff47 (diff)
Do not attempt to dereference NULL pointers when encountering an empty SCSI
bus on a dual-scsi controller abstraction, while walking the KL component tree.
-rw-r--r--sys/arch/sgi/sgi/autoconf.c4
-rw-r--r--sys/arch/sgi/sgi/sginode.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/sys/arch/sgi/sgi/autoconf.c b/sys/arch/sgi/sgi/autoconf.c
index 9ce02a6b456..70ef6d8aa00 100644
--- a/sys/arch/sgi/sgi/autoconf.c
+++ b/sys/arch/sgi/sgi/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.38 2014/03/21 22:00:59 miod Exp $ */
+/* $OpenBSD: autoconf.c,v 1.39 2014/11/24 16:40:29 miod Exp $ */
/*
* Copyright (c) 2009, 2010 Miodrag Vallat.
*
@@ -641,6 +641,8 @@ dksc_scan_cmp(klinfo_t *cmp, void *arg)
scsi2comp = (klscctl_t *)cmp;
for (i = 0; i < scsi2comp->scsi_buscnt; i++) {
scsicomp = (klscsi_t *)scsi2comp->scsi_bus[i];
+ if (scsicomp == NULL)
+ continue;
if (scsicomp->scsi_info.virtid == dksc_ctrl) {
kl_get_location(cmp, &dksc_device);
dksc_device.specific = i; /* port # */
diff --git a/sys/arch/sgi/sgi/sginode.c b/sys/arch/sgi/sgi/sginode.c
index 5163c31525c..f9bfc878263 100644
--- a/sys/arch/sgi/sgi/sginode.c
+++ b/sys/arch/sgi/sgi/sginode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sginode.c,v 1.29 2011/05/30 22:25:22 oga Exp $ */
+/* $OpenBSD: sginode.c,v 1.30 2014/11/24 16:40:29 miod Exp $ */
/*
* Copyright (c) 2008, 2009, 2011 Miodrag Vallat.
*
@@ -360,6 +360,8 @@ kl_first_pass_comp(klinfo_t *comp, void *arg)
scsi2comp = (klscctl_t *)comp;
for (i = 0; i < scsi2comp->scsi_buscnt; i++) {
scsicomp = (klscsi_t *)scsi2comp->scsi_bus[i];
+ if (scsicomp == NULL)
+ continue;
DB_PRF(("\t\tbus %d, physid 0x%02x virtid %d,"
" specific %ld, numdevs %d\n",
i, scsicomp->scsi_info.physid,