summaryrefslogtreecommitdiff
path: root/sys/dev/pci/brooktree848.c
diff options
context:
space:
mode:
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 );