summaryrefslogtreecommitdiff
path: root/sys/arch/arc
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/arc
parent0718e94007d14d484b2502651a72956542b4a5e0 (diff)
fix chrtoblk() so that it returne ENODEV for entries beyond the end of the table
Diffstat (limited to 'sys/arch/arc')
-rw-r--r--sys/arch/arc/arc/conf.c47
1 files changed, 8 insertions, 39 deletions
diff --git a/sys/arch/arc/arc/conf.c b/sys/arch/arc/arc/conf.c
index e0b0730ac97..7be82736197 100644
--- a/sys/arch/arc/arc/conf.c
+++ b/sys/arch/arc/arc/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.20 1998/05/06 05:11:16 imp Exp $ */
+/* $OpenBSD: conf.c,v 1.21 1998/07/07 03:02:32 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.20 1998/05/06 05:11:16 imp Exp $
+ * $Id: conf.c,v 1.21 1998/07/07 03:02:32 deraadt Exp $
*/
#include <sys/param.h>
@@ -282,45 +282,10 @@ static int chrtoblktbl[MAXDEV] = {
/* 20 */ NODEV,
/* 21 */ NODEV,
/* 22 */ 8,
- /* 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.
- *
- * A minimal stub routine can always return NODEV.
*/
dev_t
chrtoblk(dev)
@@ -328,7 +293,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)));
}