summaryrefslogtreecommitdiff
path: root/sys/arch/macppc/dev
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2009-10-26 20:17:28 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2009-10-26 20:17:28 +0000
commitc16d88bf4bfc8e8526f12a85971a6f35865648c5 (patch)
tree195dce594f943b0bd5fcf3230f02adb820deba01 /sys/arch/macppc/dev
parenta9810f2e4406559596eb8337a7a35f248cdbb080 (diff)
Do not do strncmp comparisons on dv_xname because longer device names which
look similar could arrive in the future. Instead, compare directly against dv_cfdata->cf_driver->cd_name Issue originally spotted by miod
Diffstat (limited to 'sys/arch/macppc/dev')
-rw-r--r--sys/arch/macppc/dev/daca.c8
-rw-r--r--sys/arch/macppc/dev/onyx.c6
-rw-r--r--sys/arch/macppc/dev/snapper.c6
-rw-r--r--sys/arch/macppc/dev/tumbler.c6
4 files changed, 13 insertions, 13 deletions
diff --git a/sys/arch/macppc/dev/daca.c b/sys/arch/macppc/dev/daca.c
index 67485fddea2..594b4c56e32 100644
--- a/sys/arch/macppc/dev/daca.c
+++ b/sys/arch/macppc/dev/daca.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: daca.c,v 1.6 2008/10/29 00:04:14 jakemsr Exp $ */
-/* $Id: daca.c,v 1.6 2008/10/29 00:04:14 jakemsr Exp $ */
+/* $OpenBSD: daca.c,v 1.7 2009/10/26 20:17:27 deraadt Exp $ */
+/* $Id: daca.c,v 1.7 2009/10/26 20:17:27 deraadt Exp $ */
/*-
* Copyright (c) 2002,2003 Tsubai Masanari. All rights reserved.
@@ -158,8 +158,8 @@ daca_defer(struct device *dev)
struct device *dv;
TAILQ_FOREACH(dv, &alldevs, dv_list)
- if (strncmp(dv->dv_xname, "kiic", 4) == 0 &&
- strncmp(dv->dv_parent->dv_xname, "macobio", 7) == 0)
+ if (strcmp(dv->dv_cfdata->cf_driver->cd_name, "kiic") == 0 &&
+ strcmp(dv->dv_parent->dv_cfdata->cf_driver->cd_name, "macobio") == 0)
sc->sc_i2c = dv;
if (sc->sc_i2c == NULL) {
printf("%s: unable to find i2c\n", sc->sc_dev.dv_xname);
diff --git a/sys/arch/macppc/dev/onyx.c b/sys/arch/macppc/dev/onyx.c
index 7a05325778d..f0f71b2a21f 100644
--- a/sys/arch/macppc/dev/onyx.c
+++ b/sys/arch/macppc/dev/onyx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: onyx.c,v 1.9 2008/10/29 00:04:14 jakemsr Exp $ */
+/* $OpenBSD: onyx.c,v 1.10 2009/10/26 20:17:27 deraadt Exp $ */
/*-
* Copyright (c) 2005 Tsubai Masanari. All rights reserved.
@@ -168,8 +168,8 @@ onyx_defer(struct device *dev)
struct device *dv;
TAILQ_FOREACH(dv, &alldevs, dv_list)
- if (strncmp(dv->dv_xname, "kiic", 4) == 0 &&
- strncmp(dv->dv_parent->dv_xname, "macobio", 7) == 0)
+ if (strcmp(dv->dv_cfdata->cf_driver->cd_name, "kiic") == 0 &&
+ strcmp(dv->dv_parent->dv_cfdata->cf_driver->cd_name, "macobio") == 0)
sc->sc_i2c = dv;
if (sc->sc_i2c == NULL) {
printf("%s: unable to find i2c\n", sc->sc_dev.dv_xname);
diff --git a/sys/arch/macppc/dev/snapper.c b/sys/arch/macppc/dev/snapper.c
index be8dd115a69..3fba8d3c8a0 100644
--- a/sys/arch/macppc/dev/snapper.c
+++ b/sys/arch/macppc/dev/snapper.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: snapper.c,v 1.34 2008/11/06 10:01:50 todd Exp $ */
+/* $OpenBSD: snapper.c,v 1.35 2009/10/26 20:17:27 deraadt Exp $ */
/* $NetBSD: snapper.c,v 1.1 2003/12/27 02:19:34 grant Exp $ */
/*-
@@ -486,8 +486,8 @@ snapper_defer(struct device *dev)
struct device *dv;
TAILQ_FOREACH(dv, &alldevs, dv_list)
- if (strncmp(dv->dv_xname, "kiic", 4) == 0 &&
- strncmp(dv->dv_parent->dv_xname, "macobio", 7) == 0)
+ if (strcmp(dv->dv_cfdata->cf_driver->cd_name, "kiic") == 0 &&
+ strcmp(dv->dv_parent->dv_cfdata->cf_driver->cd_name, "macobio") == 0)
sc->sc_i2c = dv;
if (sc->sc_i2c == NULL) {
printf("%s: unable to find i2c\n", sc->sc_dev.dv_xname);
diff --git a/sys/arch/macppc/dev/tumbler.c b/sys/arch/macppc/dev/tumbler.c
index d6bc74b0ce6..efc68fa6595 100644
--- a/sys/arch/macppc/dev/tumbler.c
+++ b/sys/arch/macppc/dev/tumbler.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tumbler.c,v 1.6 2008/10/29 00:04:14 jakemsr Exp $ */
+/* $OpenBSD: tumbler.c,v 1.7 2009/10/26 20:17:27 deraadt Exp $ */
/*-
* Copyright (c) 2001,2003 Tsubai Masanari. All rights reserved.
@@ -302,8 +302,8 @@ tumbler_defer(struct device *dev)
struct device *dv;
TAILQ_FOREACH(dv, &alldevs, dv_list)
- if (strncmp(dv->dv_xname, "kiic", 4) == 0 &&
- strncmp(dv->dv_parent->dv_xname, "macobio", 7) == 0)
+ if (strcmp(dv->dv_cfdata->cf_driver->cd_name, "kiic") == 0 &&
+ strcmp(dv->dv_parent->dv_cfdata->cf_driver->cd_name, "macobio") == 0)
sc->sc_i2c = dv;
if (sc->sc_i2c == NULL) {
printf("%s: unable to find i2c\n", sc->sc_dev.dv_xname);