summaryrefslogtreecommitdiff
path: root/sys/dev/pci/brooktree848.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1999-10-31 20:50:05 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1999-10-31 20:50:05 +0000
commitf5692d57b241d08a5f698764e56479a48bbee6b5 (patch)
tree89df187af67c4446ebb0a3d736d8b305eeac09d3 /sys/dev/pci/brooktree848.c
parent1d0968e1199a48b43046a11ae00b51a9999b70a1 (diff)
critical fixes, overdone, but who cares, a localhost crash is bad
Diffstat (limited to 'sys/dev/pci/brooktree848.c')
-rw-r--r--sys/dev/pci/brooktree848.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/dev/pci/brooktree848.c b/sys/dev/pci/brooktree848.c
index 66481bd811e..aff7daa859b 100644
--- a/sys/dev/pci/brooktree848.c
+++ b/sys/dev/pci/brooktree848.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: brooktree848.c,v 1.11 1999/08/05 21:18:42 niklas Exp $ */
+/* $OpenBSD: brooktree848.c,v 1.12 1999/10/31 20:50:04 deraadt Exp $ */
/* $Roger: brooktree848.c,v 1.85 1999/06/12 14:54:54 roger Exp $ */
/* BT848 Driver for Brooktree's Bt848, Bt848A, Bt849A, Bt878, Bt879 based cards.
@@ -8448,11 +8448,15 @@ bktr_open( dev_t dev, int flags, int fmt, struct proc *p )
int unit;
unit = UNIT( minor(dev) );
- if (unit >= NBKTR) /* unit out of range */
+ if (unit >= NBKTR || unit > bktr_cd.cd_ndevs) /* unit out of range */
return( ENXIO );
- bktr = bktr_cd.cd_devs[unit];
+ if (bktr_cd.cd_devs == NULL)
+ return( ENXIO );
+ bktr = bktr_cd.cd_devs[unit];
+ if (bktr == NULL)
+ return ( ENXIO );
if (!(bktr->flags & METEOR_INITALIZED)) /* device not found */
return( ENXIO );