summaryrefslogtreecommitdiff
path: root/sys/arch/sparc/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/sparc/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/sparc/dev')
-rw-r--r--sys/arch/sparc/dev/esp.c4
-rw-r--r--sys/arch/sparc/dev/if_le.c8
-rw-r--r--sys/arch/sparc/dev/obio.c6
3 files changed, 9 insertions, 9 deletions
diff --git a/sys/arch/sparc/dev/esp.c b/sys/arch/sparc/dev/esp.c
index 7ed4df74607..c96b1449d87 100644
--- a/sys/arch/sparc/dev/esp.c
+++ b/sys/arch/sparc/dev/esp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: esp.c,v 1.27 2009/03/29 21:53:52 sthen Exp $ */
+/* $OpenBSD: esp.c,v 1.28 2009/10/26 20:17:27 deraadt Exp $ */
/* $NetBSD: esp.c,v 1.69 1997/08/27 11:24:18 bouyer Exp $ */
/*
@@ -355,7 +355,7 @@ espattach(parent, self, aux)
mapiodev(ca->ca_ra.ra_reg, 0, ca->ca_ra.ra_len);
}
- dmachild = strncmp(parent->dv_xname, "dma", 3) == 0;
+ dmachild = strcmp(parent->dv_cfdata->cf_driver->cd_name, "dma") == 0;
if (dmachild) {
esc->sc_dma = (struct dma_softc *)parent;
esc->sc_dma->sc_esp = esc;
diff --git a/sys/arch/sparc/dev/if_le.c b/sys/arch/sparc/dev/if_le.c
index 4ddece18e54..7bf1432d45b 100644
--- a/sys/arch/sparc/dev/if_le.c
+++ b/sys/arch/sparc/dev/if_le.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_le.c,v 1.29 2007/05/29 09:54:09 sobrado Exp $ */
+/* $OpenBSD: if_le.c,v 1.30 2009/10/26 20:17:27 deraadt Exp $ */
/* $NetBSD: if_le.c,v 1.50 1997/09/09 20:54:48 pk Exp $ */
/*-
@@ -429,9 +429,9 @@ leattach(parent, self, aux)
int pri;
struct bootpath *bp;
#if defined(SUN4C) || defined(SUN4M)
- int sbuschild = strncmp(parent->dv_xname, "sbus", 4) == 0;
- int lebufchild = strncmp(parent->dv_xname, "lebuffer", 8) == 0;
- int dmachild = strncmp(parent->dv_xname, "ledma", 5) == 0;
+ int sbuschild = strcmp(parent->dv_cfdata->cf_driver->cd_name, "sbus") == 0;
+ int lebufchild = strcmp(parent->dv_cfdata->cf_driver->cd_name, "lebuffer") == 0;
+ int dmachild = strcmp(parent->dv_cfdata->cf_driver->cd_name, "ledma") == 0;
struct lebuf_softc *lebuf;
#endif
diff --git a/sys/arch/sparc/dev/obio.c b/sys/arch/sparc/dev/obio.c
index 7be6f191120..2086fbb5fb7 100644
--- a/sys/arch/sparc/dev/obio.c
+++ b/sys/arch/sparc/dev/obio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: obio.c,v 1.19 2007/10/08 17:48:06 krw Exp $ */
+/* $OpenBSD: obio.c,v 1.20 2009/10/26 20:17:27 deraadt Exp $ */
/* $NetBSD: obio.c,v 1.37 1997/07/29 09:58:11 fair Exp $ */
/*
@@ -290,7 +290,7 @@ vmesattach(parent, self, args)
void *args;
{
if (self->dv_unit > 0 ||
- (CPU_ISSUN4M && strncmp(parent->dv_xname, "vme", 3) != 0)) {
+ (CPU_ISSUN4M && strcmp(parent->dv_cfdata->cf_driver->cd_name, "vme") != 0)) {
printf(" unsupported\n");
return;
}
@@ -312,7 +312,7 @@ vmelattach(parent, self, args)
void *args;
{
if (self->dv_unit > 0 ||
- (CPU_ISSUN4M && strncmp(parent->dv_xname, "vme", 3) != 0)) {
+ (CPU_ISSUN4M && strcmp(parent->dv_cfdata->cf_driver->cd_name, "vme") != 0)) {
printf(" unsupported\n");
return;
}