diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2006-03-15 20:04:38 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2006-03-15 20:04:38 +0000 |
commit | c2cf0d972013ff2806e98e0b0c283cf38ac50fd7 (patch) | |
tree | 93f7bb36a695de54b6f438979d358a61a5800169 | |
parent | 7a98474e0906ac069d94837486659e4625c3cf41 (diff) |
Correct checks against cd_ndevs - valid numbers are strictly inferior to
cd_ndevs.
-rw-r--r-- | sys/arch/amd64/amd64/autoconf.c | 4 | ||||
-rw-r--r-- | sys/arch/hppa/dev/sti_sgc.c | 4 | ||||
-rw-r--r-- | sys/arch/i386/i386/autoconf.c | 4 | ||||
-rw-r--r-- | sys/arch/mvme68k/dev/zs.c | 4 | ||||
-rw-r--r-- | sys/arch/vax/mscp/mscp_disk.c | 6 | ||||
-rw-r--r-- | sys/arch/vax/mscp/mscp_tape.c | 4 | ||||
-rw-r--r-- | sys/dev/ic/midway.c | 4 | ||||
-rw-r--r-- | sys/dev/wscons/wsdisplay.c | 4 |
8 files changed, 17 insertions, 17 deletions
diff --git a/sys/arch/amd64/amd64/autoconf.c b/sys/arch/amd64/amd64/autoconf.c index 81804cbe4ff..d5558605f46 100644 --- a/sys/arch/amd64/amd64/autoconf.c +++ b/sys/arch/amd64/amd64/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.11 2005/12/27 18:31:08 miod Exp $ */ +/* $OpenBSD: autoconf.c,v 1.12 2006/03/15 20:04:33 miod Exp $ */ /* $NetBSD: autoconf.c,v 1.1 2003/04/26 18:39:26 fvdl Exp $ */ /*- @@ -398,7 +398,7 @@ retry: if (unit < 0) { printf("%s: not a unit number\n", &name[strlen(gc->gc_name)]); - } else if (unit > gc->gc_driver->cd_ndevs || + } else if (unit >= gc->gc_driver->cd_ndevs || gc->gc_driver->cd_devs[unit] == NULL) { printf("%d: no such unit\n", unit); } else { diff --git a/sys/arch/hppa/dev/sti_sgc.c b/sys/arch/hppa/dev/sti_sgc.c index 213f092725d..926dc87f929 100644 --- a/sys/arch/hppa/dev/sti_sgc.c +++ b/sys/arch/hppa/dev/sti_sgc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sti_sgc.c,v 1.29 2005/03/17 22:31:53 mickey Exp $ */ +/* $OpenBSD: sti_sgc.c,v 1.30 2006/03/15 20:04:36 miod Exp $ */ /* * Copyright (c) 2000-2003 Michael Shalayeff @@ -121,7 +121,7 @@ sti_sgc_probe(parent, match, aux) int rv = 0, romunmapped = 0; /* due to the graphic nature of this program do probe only one */ - if (cf->cf_unit > sti_cd.cd_ndevs) + if (sti_cd.cd_ndevs != 0) return (0); if (ca->ca_type.iodc_type != HPPA_TYPE_FIO) diff --git a/sys/arch/i386/i386/autoconf.c b/sys/arch/i386/i386/autoconf.c index 1348cd11361..117d866677e 100644 --- a/sys/arch/i386/i386/autoconf.c +++ b/sys/arch/i386/i386/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.56 2005/12/27 18:31:09 miod Exp $ */ +/* $OpenBSD: autoconf.c,v 1.57 2006/03/15 20:04:36 miod Exp $ */ /* $NetBSD: autoconf.c,v 1.20 1996/05/03 19:41:56 christos Exp $ */ /*- @@ -386,7 +386,7 @@ retry: if (unit < 0) { printf("%s: not a unit number\n", &name[strlen(gc->gc_name)]); - } else if (unit > gc->gc_driver->cd_ndevs || + } else if (unit >= gc->gc_driver->cd_ndevs || gc->gc_driver->cd_devs[unit] == NULL) { printf("%d: no such unit\n", unit); } else { diff --git a/sys/arch/mvme68k/dev/zs.c b/sys/arch/mvme68k/dev/zs.c index d68ca8bac59..23c6cdfcab4 100644 --- a/sys/arch/mvme68k/dev/zs.c +++ b/sys/arch/mvme68k/dev/zs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zs.c,v 1.23 2006/01/01 11:59:39 miod Exp $ */ +/* $OpenBSD: zs.c,v 1.24 2006/03/15 20:04:36 miod Exp $ */ /* * Copyright (c) 2000 Steve Murphree, Jr. @@ -387,7 +387,7 @@ zsclose(dev, flag, mode, p) struct zssoftc *sc; int s; - if (zsunit(dev) > zs_cd.cd_ndevs || + if (zsunit(dev) >= zs_cd.cd_ndevs || (sc = (struct zssoftc *) zs_cd.cd_devs[zsunit(dev)]) == NULL) return (ENODEV); zp = &sc->sc_zs[zsside(dev)]; diff --git a/sys/arch/vax/mscp/mscp_disk.c b/sys/arch/vax/mscp/mscp_disk.c index 1b73fb190bd..08520919bc3 100644 --- a/sys/arch/vax/mscp/mscp_disk.c +++ b/sys/arch/vax/mscp/mscp_disk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mscp_disk.c,v 1.15 2004/09/24 19:29:11 kettenis Exp $ */ +/* $OpenBSD: mscp_disk.c,v 1.16 2006/03/15 20:04:36 miod Exp $ */ /* $NetBSD: mscp_disk.c,v 1.30 2001/11/13 07:38:28 lukem Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. @@ -294,7 +294,7 @@ rastrategy(bp) * Make sure this is a reasonable drive to use. */ unit = DISKUNIT(bp->b_dev); - if (unit > ra_cd.cd_ndevs || (ra = ra_cd.cd_devs[unit]) == NULL) { + if (unit >= ra_cd.cd_ndevs || (ra = ra_cd.cd_devs[unit]) == NULL) { bp->b_error = ENXIO; bp->b_flags |= B_ERROR; goto done; @@ -685,7 +685,7 @@ rxstrategy(bp) * Make sure this is a reasonable drive to use. */ unit = DISKUNIT(bp->b_dev); - if (unit > rx_cd.cd_ndevs || (rx = rx_cd.cd_devs[unit]) == NULL) { + if (unit >= rx_cd.cd_ndevs || (rx = rx_cd.cd_devs[unit]) == NULL) { bp->b_error = ENXIO; bp->b_flags |= B_ERROR; goto done; diff --git a/sys/arch/vax/mscp/mscp_tape.c b/sys/arch/vax/mscp/mscp_tape.c index b905624d517..5eb952fa3e8 100644 --- a/sys/arch/vax/mscp/mscp_tape.c +++ b/sys/arch/vax/mscp/mscp_tape.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mscp_tape.c,v 1.8 2002/06/08 08:50:26 art Exp $ */ +/* $OpenBSD: mscp_tape.c,v 1.9 2006/03/15 20:04:36 miod Exp $ */ /* $NetBSD: mscp_tape.c,v 1.16 2001/11/13 07:38:28 lukem Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. @@ -263,7 +263,7 @@ mtstrategy(bp) * Make sure this is a reasonable drive to use. */ unit = mtunit(bp->b_dev); - if (unit > mt_cd.cd_ndevs || (mt = mt_cd.cd_devs[unit]) == NULL) { + if (unit >= mt_cd.cd_ndevs || (mt = mt_cd.cd_devs[unit]) == NULL) { bp->b_error = ENXIO; goto bad; } diff --git a/sys/dev/ic/midway.c b/sys/dev/ic/midway.c index 17f51400d47..473b658fa48 100644 --- a/sys/dev/ic/midway.c +++ b/sys/dev/ic/midway.c @@ -1,4 +1,4 @@ -/* $OpenBSD: midway.c,v 1.35 2005/12/17 07:31:27 miod Exp $ */ +/* $OpenBSD: midway.c,v 1.36 2006/03/15 20:04:37 miod Exp $ */ /* (sync'd to midway.c 1.68) */ /* @@ -3203,7 +3203,7 @@ int unit, addr, len; struct en_softc *sc; u_int32_t reg; - if (unit < 0 || unit > en_cd.cd_ndevs || + if (unit < 0 || unit >= en_cd.cd_ndevs || (sc = (struct en_softc *) en_cd.cd_devs[unit]) == NULL) { printf("invalid unit number: %d\n", unit); return(0); diff --git a/sys/dev/wscons/wsdisplay.c b/sys/dev/wscons/wsdisplay.c index 8c412d5c8b7..144ca307378 100644 --- a/sys/dev/wscons/wsdisplay.c +++ b/sys/dev/wscons/wsdisplay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsdisplay.c,v 1.65 2005/11/05 16:04:20 uwe Exp $ */ +/* $OpenBSD: wsdisplay.c,v 1.66 2006/03/15 20:04:37 miod Exp $ */ /* $NetBSD: wsdisplay.c,v 1.82 2005/02/27 00:27:52 perry Exp $ */ /* @@ -3100,7 +3100,7 @@ wsmoused_release(struct wsdisplay_softc *sc) if (is_wsmouse && (minor(sc->wsmoused_dev) <= NWSMOUSE)) { /* /dev/wsmouseX case */ - if (minor(sc->wsmoused_dev) <= wsmouse_cd.cd_ndevs) { + if (minor(sc->wsmoused_dev) < wsmouse_cd.cd_ndevs) { wsms_dev = wsms_dev_list[minor(sc->wsmoused_dev)]; } |