Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern in devsw_name2blk(), as we use strncmp(), make sure...
details: https://anonhg.NetBSD.org/src/rev/256efae3942d
branches: trunk
changeset: 542550:256efae3942d
user: mrg <mrg%NetBSD.org@localhost>
date: Sat Feb 01 11:12:35 2003 +0000
description:
in devsw_name2blk(), as we use strncmp(), make sure the next character
in the device is either nul or a digit. this avoids "raid0" being
matched as the "ra" device (and thus failing to find anything at all
causing my raid0 root to fail) on my vax.
diffstat:
sys/kern/subr_devsw.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diffs (32 lines):
diff -r c628f1b5fa11 -r 256efae3942d sys/kern/subr_devsw.c
--- a/sys/kern/subr_devsw.c Sat Feb 01 10:43:20 2003 +0000
+++ b/sys/kern/subr_devsw.c Sat Feb 01 11:12:35 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_devsw.c,v 1.4 2002/09/15 14:29:01 tsutsui Exp $ */
+/* $NetBSD: subr_devsw.c,v 1.5 2003/02/01 11:12:35 mrg Exp $ */
/*-
* Copyright (c) 2001,2002 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -379,15 +379,20 @@
return (-1);
for (i = 0 ; i < max_devsw_convs ; i++) {
+ size_t len;
+
conv = &devsw_conv[i];
if (conv->d_name == NULL)
continue;
- if (strncmp(conv->d_name, name, strlen(conv->d_name)) != 0)
+ len = strlen(conv->d_name);
+ if (strncmp(conv->d_name, name, len) != 0)
+ continue;
+ if (*(name +len) && !isdigit(*(name + len)))
continue;
bmajor = conv->d_bmajor;
if (bmajor < 0 || bmajor >= max_bdevsws ||
bdevsw[bmajor] == NULL)
- return (-1);
+ break;
if (devname != NULL) {
#ifdef DEVSW_DEBUG
if (strlen(conv->d_name) >= devnamelen)
Home |
Main Index |
Thread Index |
Old Index