summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2006-03-15 20:03:08 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2006-03-15 20:03:08 +0000
commit7a98474e0906ac069d94837486659e4625c3cf41 (patch)
treee6f4d0c586aa8b01085c657132c319cb6f998c96 /sys/dev
parentb9a2c51f2cb93f4b6b2de48dc3ca86e1eef33511 (diff)
Entries in cd_devs[] may be NULL, so be sure to check for them in your
device open() function.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/wdt.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/pci/wdt.c b/sys/dev/pci/wdt.c
index 1e261081833..6c032f191c0 100644
--- a/sys/dev/pci/wdt.c
+++ b/sys/dev/pci/wdt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wdt.c,v 1.6 2005/09/11 18:17:08 mickey Exp $ */
+/* $OpenBSD: wdt.c,v 1.7 2006/03/15 20:03:07 miod Exp $ */
/*-
* Copyright (c) 1998,1999 Alex Nash
@@ -217,8 +217,8 @@ wdtattach (parent, self, aux)
int
wdtopen (dev_t dev, int flags, int fmt, struct proc *p)
{
- if (UNIT(dev) >= wdt_cd.cd_ndevs)
- return(ENXIO);
+ if (UNIT(dev) >= wdt_cd.cd_ndevs || wdt_cd.cd_devs[UNIT(dev)] == NULL)
+ return (ENXIO);
return(0);
}