summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2009-06-02 11:38:21 +0000
committerderaadt <deraadt@openbsd.org>2009-06-02 11:38:21 +0000
commit4148eb344ddda006f5309263e196864d00a90ec3 (patch)
tree649470ee63384e369f7b819aa810fe7b02c603db /sys
parentLibevent may do an upcall with both EV_READ and EV_WRITE set. (diff)
downloadwireguard-openbsd-4148eb344ddda006f5309263e196864d00a90ec3.tar.xz
wireguard-openbsd-4148eb344ddda006f5309263e196864d00a90ec3.zip
When we fail to find the controller type, don't continue on using the next
consecutive index which is outside the array; found by Parfait ok oga guenther
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/eisa/cac_eisa.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/sys/dev/eisa/cac_eisa.c b/sys/dev/eisa/cac_eisa.c
index 120e9e4d871..1e9ce07c86f 100644
--- a/sys/dev/eisa/cac_eisa.c
+++ b/sys/dev/eisa/cac_eisa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cac_eisa.c,v 1.3 2008/06/26 05:42:14 ray Exp $ */
+/* $OpenBSD: cac_eisa.c,v 1.4 2009/06/02 11:38:21 deraadt Exp $ */
/* $NetBSD: cac_eisa.c,v 1.1 2000/09/01 12:15:20 ad Exp $ */
/*-
@@ -161,6 +161,18 @@ cac_eisa_attach(parent, self, aux)
return;
}
+ /*
+ * Print board type and attach to the bus-independent code.
+ */
+ for (i = 0; i < nitems(cac_eisa_type); i++)
+ if (strcmp(ea->ea_idstring, cac_eisa_type[i].ct_prodstr) == 0)
+ break;
+
+ if (i == nitems(cac_eisa_type)) {
+ printf(": failed to attach %s\n", ea->ea_idstring);
+ return;
+ }
+
sc->sc_iot = iot;
sc->sc_ioh = ioh;
sc->sc_dmat = ea->ea_dmat;
@@ -201,13 +213,6 @@ cac_eisa_attach(parent, self, aux)
return;
}
- /*
- * Print board type and attach to the bus-independent code.
- */
- for (i = 0; i < sizeof(cac_eisa_type) / sizeof(cac_eisa_type[0]); i++)
- if (strcmp(ea->ea_idstring, cac_eisa_type[i].ct_prodstr) == 0)
- break;
-
printf(" %s: Compaq %s\n", intrstr, cac_eisa_type[i].ct_typestr);
sc->sc_cl = cac_eisa_type[i].ct_linkage;
cac_init(sc, 0);