summaryrefslogtreecommitdiff
path: root/sys/arch/kbus
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/kbus
parent0718e94007d14d484b2502651a72956542b4a5e0 (diff)
fix chrtoblk() so that it returne ENODEV for entries beyond the end of the table
Diffstat (limited to 'sys/arch/kbus')
-rw-r--r--sys/arch/kbus/kbus/conf.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/sys/arch/kbus/kbus/conf.c b/sys/arch/kbus/kbus/conf.c
index d9c33931d4a..00a833e13de 100644
--- a/sys/arch/kbus/kbus/conf.c
+++ b/sys/arch/kbus/kbus/conf.c
@@ -389,14 +389,6 @@ static int chrtoblktbl[] = {
/*108 */ NODEV,
/*109 */ NODEV,
/*110 */ 8,
- /*111 */ NODEV,
- /*112 */ NODEV,
- /*113 */ NODEV,
- /*114 */ NODEV,
- /*115 */ NODEV,
- /*116 */ NODEV,
- /*117 */ NODEV,
- /*118 */ NODEV,
};
/*
@@ -408,7 +400,8 @@ chrtoblk(dev)
{
int blkmaj;
- if (major(dev) >= nchrdev)
+ if (major(dev) >= MAXDEV ||
+ major(dev) > sizeof(chrtoblktbl)/sizeof(chrtoblktbl[0]))
return (NODEV);
blkmaj = chrtoblktbl[major(dev)];
if (blkmaj == NODEV)