diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2006-03-15 20:03:08 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2006-03-15 20:03:08 +0000 |
commit | 7a98474e0906ac069d94837486659e4625c3cf41 (patch) | |
tree | e6f4d0c586aa8b01085c657132c319cb6f998c96 /sys/arch/sparc | |
parent | b9a2c51f2cb93f4b6b2de48dc3ca86e1eef33511 (diff) |
Entries in cd_devs[] may be NULL, so be sure to check for them in your
device open() function.
Diffstat (limited to 'sys/arch/sparc')
-rw-r--r-- | sys/arch/sparc/dev/flash.c | 4 | ||||
-rw-r--r-- | sys/arch/sparc/dev/scf.c | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/sys/arch/sparc/dev/flash.c b/sys/arch/sparc/dev/flash.c index 5f3611f9440..769d21450a9 100644 --- a/sys/arch/sparc/dev/flash.c +++ b/sys/arch/sparc/dev/flash.c @@ -1,4 +1,4 @@ -/* $OpenBSD: flash.c,v 1.4 2006/03/04 12:38:58 miod Exp $ */ +/* $OpenBSD: flash.c,v 1.5 2006/03/15 20:03:06 miod Exp $ */ /* * Copyright (c) 1999 Jason L. Wright (jason@thought.net) @@ -125,6 +125,8 @@ flashopen(dev, flags, mode, p) if (card >= flash_cd.cd_ndevs) return (ENXIO); sc = flash_cd.cd_devs[card]; + if (sc == NULL) + return (ENXIO); if (sc->sc_open) return (EBUSY); sc->sc_open = 1; diff --git a/sys/arch/sparc/dev/scf.c b/sys/arch/sparc/dev/scf.c index 4c3780fc33a..9d67cd4b138 100644 --- a/sys/arch/sparc/dev/scf.c +++ b/sys/arch/sparc/dev/scf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scf.c,v 1.9 2006/03/04 12:38:58 miod Exp $ */ +/* $OpenBSD: scf.c,v 1.10 2006/03/15 20:03:06 miod Exp $ */ /* * Copyright (c) 1999 Jason L. Wright (jason@thought.net) @@ -153,8 +153,9 @@ scfopen(dev, flags, mode, p) if (card >= scf_cd.cd_ndevs) return (ENXIO); - sc = scf_cd.cd_devs[card]; + if (sc == NULL) + return (ENXIO); if (sc->sc_open) return (EBUSY); |