diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-07-07 03:02:52 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-07-07 03:02:52 +0000 |
commit | b6f917e38f32ad82988462d315c2cc55cf1bf038 (patch) | |
tree | 5cdca187b9174c4ca42772ef5bc06e07679f4f92 /sys/arch/arm32 | |
parent | 0718e94007d14d484b2502651a72956542b4a5e0 (diff) |
fix chrtoblk() so that it returne ENODEV for entries beyond the end of the table
Diffstat (limited to 'sys/arch/arm32')
-rw-r--r-- | sys/arch/arm32/arm32/conf.c | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/sys/arch/arm32/arm32/conf.c b/sys/arch/arm32/arm32/conf.c index 8a6f8f6ac94..d6403058df2 100644 --- a/sys/arch/arm32/arm32/conf.c +++ b/sys/arch/arm32/arm32/conf.c @@ -355,38 +355,20 @@ static int chrtoblktbl[] = { /* 24 */ 24, /* 25 */ 25, /* 26 */ 26, - /* 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, }; /* * Convert a character device number to a block device number. */ - dev_t chrtoblk(dev) dev_t 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) return (NODEV); |