summaryrefslogtreecommitdiff
path: root/sys/arch/wgrisc
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1998-07-07 03:02:52 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1998-07-07 03:02:52 +0000
commitb6f917e38f32ad82988462d315c2cc55cf1bf038 (patch)
tree5cdca187b9174c4ca42772ef5bc06e07679f4f92 /sys/arch/wgrisc
parent0718e94007d14d484b2502651a72956542b4a5e0 (diff)
fix chrtoblk() so that it returne ENODEV for entries beyond the end of the table
Diffstat (limited to 'sys/arch/wgrisc')
-rw-r--r--sys/arch/wgrisc/wgrisc/conf.c45
1 files changed, 8 insertions, 37 deletions
diff --git a/sys/arch/wgrisc/wgrisc/conf.c b/sys/arch/wgrisc/wgrisc/conf.c
index 516e2018df1..7df87ae56f4 100644
--- a/sys/arch/wgrisc/wgrisc/conf.c
+++ b/sys/arch/wgrisc/wgrisc/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.4 1997/11/23 05:22:00 mickey Exp $ */
+/* $OpenBSD: conf.c,v 1.5 1998/07/07 03:02:51 deraadt Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)conf.c 8.2 (Berkeley) 11/14/93
- * $Id: conf.c,v 1.4 1997/11/23 05:22:00 mickey Exp $
+ * $Id: conf.c,v 1.5 1998/07/07 03:02:51 deraadt Exp $
*/
#include <sys/param.h>
@@ -249,41 +249,8 @@ static int chrtoblktbl[MAXDEV] = {
/* 20 */ NODEV,
/* 21 */ NODEV,
/* 22 */ 10,
- /* 23 */ NODEV,
- /* 24 */ NODEV,
- /* 25 */ NODEV,
- /* 26 */ NODEV,
- /* 27 */ NODEV,
- /* 28 */ NODEV,
- /* 29 */ NODEV,
- /* 30 */ NODEV,
- /* 31 */ NODEV,
- /* 32 */ NODEV,
- /* 33 */ NODEV,
- /* 34 */ NODEV,
- /* 35 */ NODEV,
- /* 36 */ NODEV,
- /* 37 */ NODEV,
- /* 38 */ NODEV,
- /* 39 */ NODEV,
- /* 40 */ NODEV,
- /* 41 */ NODEV,
- /* 42 */ NODEV,
- /* 43 */ NODEV,
- /* 44 */ NODEV,
- /* 45 */ NODEV,
- /* 46 */ NODEV,
- /* 47 */ NODEV,
- /* 48 */ NODEV,
- /* 49 */ NODEV,
- /* 50 */ NODEV,
- /* 51 */ NODEV,
- /* 52 */ NODEV,
- /* 53 */ NODEV,
- /* 54 */ NODEV,
- /* 55 */ NODEV,
- /* 56 */ NODEV,
};
+
/*
* Routine to convert from character to block device number.
*
@@ -294,7 +261,11 @@ chrtoblk(dev)
{
int blkmaj;
- if (major(dev) >= MAXDEV || (blkmaj = chrtoblktbl[major(dev)]) == NODEV)
+ if (major(dev) >= MAXDEV ||
+ major(dev) > sizeof(chrtoblktbl)/sizeof(chrtoblktbl[0]))
+ return (NODEV);
+ blkmaj = chrtoblktbl[major(dev)];
+ if (blkmaj == NODEV)
return (NODEV);
return (makedev(blkmaj, minor(dev)));
}