diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2006-04-17 13:30:03 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2006-04-17 13:30:03 +0000 |
commit | 21e807539ec0f1fbe79a418aa610f7f6787e171b (patch) | |
tree | 296945f52d8631d899479fb5b1c6b2992b1b0520 /sys/arch/mvme88k/dev | |
parent | 27a592414832adb9ca18f73d3d83d5f3ffbd7df1 (diff) |
Oops, removed a safety check in dartopen() in previous commit by mistake.
Diffstat (limited to 'sys/arch/mvme88k/dev')
-rw-r--r-- | sys/arch/mvme88k/dev/dart.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/arch/mvme88k/dev/dart.c b/sys/arch/mvme88k/dev/dart.c index bd10b54a4cf..218eb3d4c79 100644 --- a/sys/arch/mvme88k/dev/dart.c +++ b/sys/arch/mvme88k/dev/dart.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dart.c,v 1.46 2006/04/15 22:32:42 miod Exp $ */ +/* $OpenBSD: dart.c,v 1.47 2006/04/17 13:30:02 miod Exp $ */ /* * Mach Operating System @@ -389,7 +389,7 @@ dartmctl(dev_t dev, int flags, int how) if (dart_cd.cd_ndevs == 0 || port >= NDARTPORTS) return (ENODEV); - sc = (struct dartsoftc *) dart_cd.cd_devs[0]; + sc = (struct dartsoftc *)dart_cd.cd_devs[0]; dart = &sc->sc_dart[port]; s = spltty(); @@ -426,8 +426,8 @@ dartioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) struct dart_info *dart; struct dartsoftc *sc; - sc = (struct dartsoftc *) dart_cd.cd_devs[0]; port = DART_PORT(dev); + sc = (struct dartsoftc *)dart_cd.cd_devs[0]; dart = &sc->sc_dart[port]; tp = dart->tty; @@ -634,8 +634,10 @@ dartopen(dev_t dev, int flag, int mode, struct proc *p) struct dartsoftc *sc; struct tty *tp; - sc = (struct dartsoftc *) dart_cd.cd_devs[0]; /* the only one */ port = DART_PORT(dev); + if (dart_cd.cd_ndevs == 0 || port >= NDARTPORTS) + return (ENODEV); + sc = (struct dartsoftc *)dart_cd.cd_devs[0]; /* the only one */ dart = &sc->sc_dart[port]; s = spltty(); @@ -686,7 +688,7 @@ dartclose(dev_t dev, int flag, int mode, struct proc *p) struct dartsoftc *sc; int port; - sc = (struct dartsoftc *) dart_cd.cd_devs[0]; + sc = (struct dartsoftc *)dart_cd.cd_devs[0]; port = DART_PORT(dev); dart = &sc->sc_dart[port]; @@ -705,7 +707,7 @@ dartread(dev_t dev, struct uio *uio, int flag) struct dart_info *dart; struct dartsoftc *sc; - sc = (struct dartsoftc *) dart_cd.cd_devs[0]; + sc = (struct dartsoftc *)dart_cd.cd_devs[0]; port = DART_PORT(dev); dart = &sc->sc_dart[port]; |