summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2012-10-20 12:00:34 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2012-10-20 12:00:34 +0000
commitd18738476b5eacf200983cb467f53147dcec01b2 (patch)
tree6ae1fabccc87276232bb4b3083248592a594b6fb /sys/arch
parent055b909a1ca42c416774a7d0679c69fa400ac823 (diff)
off-by-one in device number check; found the hard way and reported by J Sisson.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/sparc64/dev/sbbc.c14
-rw-r--r--sys/arch/sparc64/dev/vcctty.c14
-rw-r--r--sys/arch/sparc64/dev/vcons.c14
3 files changed, 21 insertions, 21 deletions
diff --git a/sys/arch/sparc64/dev/sbbc.c b/sys/arch/sparc64/dev/sbbc.c
index 02d84098bdb..c2a9c4f4535 100644
--- a/sys/arch/sparc64/dev/sbbc.c
+++ b/sys/arch/sparc64/dev/sbbc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sbbc.c,v 1.10 2010/07/02 17:27:01 nicm Exp $ */
+/* $OpenBSD: sbbc.c,v 1.11 2012/10/20 12:00:33 miod Exp $ */
/*
* Copyright (c) 2008 Mark Kettenis
*
@@ -506,7 +506,7 @@ sbbcopen(dev_t dev, int flag, int mode, struct proc *p)
struct tty *tp;
int unit = minor(dev);
- if (unit > sbbc_cd.cd_ndevs)
+ if (unit >= sbbc_cd.cd_ndevs)
return (ENXIO);
sc = sbbc_cd.cd_devs[unit];
if (sc == NULL)
@@ -542,7 +542,7 @@ sbbcclose(dev_t dev, int flag, int mode, struct proc *p)
struct tty *tp;
int unit = minor(dev);
- if (unit > sbbc_cd.cd_ndevs)
+ if (unit >= sbbc_cd.cd_ndevs)
return (ENXIO);
sc = sbbc_cd.cd_devs[unit];
if (sc == NULL)
@@ -561,7 +561,7 @@ sbbcread(dev_t dev, struct uio *uio, int flag)
struct tty *tp;
int unit = minor(dev);
- if (unit > sbbc_cd.cd_ndevs)
+ if (unit >= sbbc_cd.cd_ndevs)
return (ENXIO);
sc = sbbc_cd.cd_devs[unit];
if (sc == NULL)
@@ -578,7 +578,7 @@ sbbcwrite(dev_t dev, struct uio *uio, int flag)
struct tty *tp;
int unit = minor(dev);
- if (unit > sbbc_cd.cd_ndevs)
+ if (unit >= sbbc_cd.cd_ndevs)
return (ENXIO);
sc = sbbc_cd.cd_devs[unit];
if (sc == NULL)
@@ -596,7 +596,7 @@ sbbcioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
int unit = minor(dev);
int error;
- if (unit > sbbc_cd.cd_ndevs)
+ if (unit >= sbbc_cd.cd_ndevs)
return (ENXIO);
sc = sbbc_cd.cd_devs[unit];
if (sc == NULL)
@@ -650,7 +650,7 @@ sbbctty(dev_t dev)
struct sbbc_softc *sc;
int unit = minor(dev);
- if (unit > sbbc_cd.cd_ndevs)
+ if (unit >= sbbc_cd.cd_ndevs)
return (NULL);
sc = sbbc_cd.cd_devs[unit];
if (sc == NULL)
diff --git a/sys/arch/sparc64/dev/vcctty.c b/sys/arch/sparc64/dev/vcctty.c
index b6e5bdceb9d..1f839962d58 100644
--- a/sys/arch/sparc64/dev/vcctty.c
+++ b/sys/arch/sparc64/dev/vcctty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vcctty.c,v 1.6 2010/07/02 17:27:01 nicm Exp $ */
+/* $OpenBSD: vcctty.c,v 1.7 2012/10/20 12:00:33 miod Exp $ */
/*
* Copyright (c) 2009 Mark Kettenis
*
@@ -302,7 +302,7 @@ vccttyopen(dev_t dev, int flag, int mode, struct proc *p)
struct tty *tp;
int unit = minor(dev);
- if (unit > vcctty_cd.cd_ndevs)
+ if (unit >= vcctty_cd.cd_ndevs)
return (ENXIO);
sc = vcctty_cd.cd_devs[unit];
if (sc == NULL)
@@ -338,7 +338,7 @@ vccttyclose(dev_t dev, int flag, int mode, struct proc *p)
struct tty *tp;
int unit = minor(dev);
- if (unit > vcctty_cd.cd_ndevs)
+ if (unit >= vcctty_cd.cd_ndevs)
return (ENXIO);
sc = vcctty_cd.cd_devs[unit];
if (sc == NULL)
@@ -357,7 +357,7 @@ vccttyread(dev_t dev, struct uio *uio, int flag)
struct tty *tp;
int unit = minor(dev);
- if (unit > vcctty_cd.cd_ndevs)
+ if (unit >= vcctty_cd.cd_ndevs)
return (ENXIO);
sc = vcctty_cd.cd_devs[unit];
if (sc == NULL)
@@ -374,7 +374,7 @@ vccttywrite(dev_t dev, struct uio *uio, int flag)
struct tty *tp;
int unit = minor(dev);
- if (unit > vcctty_cd.cd_ndevs)
+ if (unit >= vcctty_cd.cd_ndevs)
return (ENXIO);
sc = vcctty_cd.cd_devs[unit];
if (sc == NULL)
@@ -392,7 +392,7 @@ vccttyioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
int unit = minor(dev);
int error;
- if (unit > vcctty_cd.cd_ndevs)
+ if (unit >= vcctty_cd.cd_ndevs)
return (ENXIO);
sc = vcctty_cd.cd_devs[unit];
if (sc == NULL)
@@ -461,7 +461,7 @@ vccttytty(dev_t dev)
struct vcctty_softc *sc;
int unit = minor(dev);
- if (unit > vcctty_cd.cd_ndevs)
+ if (unit >= vcctty_cd.cd_ndevs)
return (NULL);
sc = vcctty_cd.cd_devs[unit];
if (sc == NULL)
diff --git a/sys/arch/sparc64/dev/vcons.c b/sys/arch/sparc64/dev/vcons.c
index 422613bfe13..4cc71a409b9 100644
--- a/sys/arch/sparc64/dev/vcons.c
+++ b/sys/arch/sparc64/dev/vcons.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vcons.c,v 1.11 2011/01/04 20:48:56 kettenis Exp $ */
+/* $OpenBSD: vcons.c,v 1.12 2012/10/20 12:00:33 miod Exp $ */
/*
* Copyright (c) 2008 Mark Kettenis
*
@@ -173,7 +173,7 @@ vconsopen(dev_t dev, int flag, int mode, struct proc *p)
struct tty *tp;
int unit = minor(dev);
- if (unit > vcons_cd.cd_ndevs)
+ if (unit >= vcons_cd.cd_ndevs)
return (ENXIO);
sc = vcons_cd.cd_devs[unit];
if (sc == NULL)
@@ -209,7 +209,7 @@ vconsclose(dev_t dev, int flag, int mode, struct proc *p)
struct tty *tp;
int unit = minor(dev);
- if (unit > vcons_cd.cd_ndevs)
+ if (unit >= vcons_cd.cd_ndevs)
return (ENXIO);
sc = vcons_cd.cd_devs[unit];
if (sc == NULL)
@@ -228,7 +228,7 @@ vconsread(dev_t dev, struct uio *uio, int flag)
struct tty *tp;
int unit = minor(dev);
- if (unit > vcons_cd.cd_ndevs)
+ if (unit >= vcons_cd.cd_ndevs)
return (ENXIO);
sc = vcons_cd.cd_devs[unit];
if (sc == NULL)
@@ -245,7 +245,7 @@ vconswrite(dev_t dev, struct uio *uio, int flag)
struct tty *tp;
int unit = minor(dev);
- if (unit > vcons_cd.cd_ndevs)
+ if (unit >= vcons_cd.cd_ndevs)
return (ENXIO);
sc = vcons_cd.cd_devs[unit];
if (sc == NULL)
@@ -263,7 +263,7 @@ vconsioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
int unit = minor(dev);
int error;
- if (unit > vcons_cd.cd_ndevs)
+ if (unit >= vcons_cd.cd_ndevs)
return (ENXIO);
sc = vcons_cd.cd_devs[unit];
if (sc == NULL)
@@ -317,7 +317,7 @@ vconstty(dev_t dev)
struct vcons_softc *sc;
int unit = minor(dev);
- if (unit > vcons_cd.cd_ndevs)
+ if (unit >= vcons_cd.cd_ndevs)
return (NULL);
sc = vcons_cd.cd_devs[unit];
if (sc == NULL)