diff options
-rw-r--r-- | sys/arch/sparc/sparc/autoconf.c | 19 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/autoconf.c | 17 |
2 files changed, 28 insertions, 8 deletions
diff --git a/sys/arch/sparc/sparc/autoconf.c b/sys/arch/sparc/sparc/autoconf.c index 82e83456748..357ef31b836 100644 --- a/sys/arch/sparc/sparc/autoconf.c +++ b/sys/arch/sparc/sparc/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.66 2005/04/21 00:15:43 deraadt Exp $ */ +/* $OpenBSD: autoconf.c,v 1.67 2005/05/01 18:15:46 miod Exp $ */ /* $NetBSD: autoconf.c,v 1.73 1997/07/29 09:41:53 fair Exp $ */ /* @@ -393,9 +393,20 @@ bootpath_build() cp = str2hex(++cp, &bp->val[0]); if (*cp == ',') cp = str2hex(++cp, &bp->val[1]); - if (*cp == ':') - /* XXX - we handle just one char */ - bp->val[2] = *++cp - 'a', ++cp; + if (*cp == ':') { + /* + * We only store one character here, + * as we will only use this field + * to compute a partition index + * for block devices. However, it + * might be an ethernet media + * specification, so be sure to + * skip all letters. + */ + bp->val[2] = *++cp - 'a'; + while (*cp != '\0' && *cp != '/') + cp++; + } } else { bp->val[0] = -1; /* no #'s: assume unit 0, no sbus offset/adddress */ diff --git a/sys/arch/sparc64/sparc64/autoconf.c b/sys/arch/sparc64/sparc64/autoconf.c index 598cc4f728f..fe7b0c0de3d 100644 --- a/sys/arch/sparc64/sparc64/autoconf.c +++ b/sys/arch/sparc64/sparc64/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.39 2005/04/21 00:15:43 deraadt Exp $ */ +/* $OpenBSD: autoconf.c,v 1.40 2005/05/01 18:15:49 miod Exp $ */ /* $NetBSD: autoconf.c,v 1.51 2001/07/24 19:32:11 eeh Exp $ */ /* @@ -310,9 +310,18 @@ bootpath_build() cp = str2hex(++cp, &bp->val[0]); if (*cp == ',') cp = str2hex(++cp, &bp->val[1]); - if (*cp == ':') - /* XXX - we handle just one char */ - bp->val[2] = *++cp - 'a', ++cp; + if (*cp == ':') { + /* + * We only store one character here, as we will + * only use this field to compute a partition + * index for block devices. However, it might + * be an ethernet media specification, so be + * sure to skip all letters. + */ + bp->val[2] = *++cp - 'a'; + while (*cp != '\0' && *cp != '/') + cp++; + } } else { bp->val[0] = -1; /* no #'s: assume unit 0, no sbus offset/adddress */ |