summaryrefslogtreecommitdiff
path: root/sys/arch/sparc
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/sparc')
-rw-r--r--sys/arch/sparc/dev/presto.c16
-rw-r--r--sys/arch/sparc/dev/xd.c24
-rw-r--r--sys/arch/sparc/dev/xy.c24
3 files changed, 21 insertions, 43 deletions
diff --git a/sys/arch/sparc/dev/presto.c b/sys/arch/sparc/dev/presto.c
index f9d05429d4c..b242ce3fd97 100644
--- a/sys/arch/sparc/dev/presto.c
+++ b/sys/arch/sparc/dev/presto.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: presto.c,v 1.21 2011/06/03 21:14:11 matthew Exp $ */
+/* $OpenBSD: presto.c,v 1.22 2011/07/06 04:49:35 matthew Exp $ */
/*
* Copyright (c) 2003, Miodrag Vallat.
* All rights reserved.
@@ -280,15 +280,14 @@ prestostrategy(struct buf *bp)
sc = (struct presto_softc *)device_lookup(&presto_cd, unit);
/* Sort rogue requests out */
- if (sc == NULL || bp->b_blkno < 0 ||
- (bp->b_bcount % sc->sc_dk.dk_label->d_secsize) != 0) {
+ if (sc == NULL) {
bp->b_error = EINVAL;
goto bad;
}
- /* Do not write on "no trespassing" areas... */
- if (bounds_check_with_label(bp, sc->sc_dk.dk_label) <= 0)
- goto bad;
+ /* Validate the request. */
+ if (bounds_check_with_label(bp, sc->sc_dk.dk_label) == -1)
+ goto done;
/* Bound the request size, then move data between buf and nvram */
bp->b_resid = bp->b_bcount;
@@ -303,11 +302,10 @@ prestostrategy(struct buf *bp)
bp->b_resid -= count;
goto done;
-bad:
+ bad:
bp->b_flags |= B_ERROR;
bp->b_resid = bp->b_bcount;
-
-done:
+ done:
s = splbio();
biodone(bp);
splx(s);
diff --git a/sys/arch/sparc/dev/xd.c b/sys/arch/sparc/dev/xd.c
index af721ed86e2..166dee9db63 100644
--- a/sys/arch/sparc/dev/xd.c
+++ b/sys/arch/sparc/dev/xd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xd.c,v 1.55 2011/06/05 18:40:33 matthew Exp $ */
+/* $OpenBSD: xd.c,v 1.56 2011/07/06 04:49:35 matthew Exp $ */
/* $NetBSD: xd.c,v 1.37 1997/07/29 09:58:16 fair Exp $ */
/*
@@ -1011,9 +1011,7 @@ xdstrategy(bp)
/* check for live device */
- if (unit >= xd_cd.cd_ndevs || (xd = xd_cd.cd_devs[unit]) == 0 ||
- bp->b_blkno < 0 ||
- (bp->b_bcount % xd->sc_dk.dk_label->d_secsize) != 0) {
+ if (unit >= xd_cd.cd_ndevs || (xd = xd_cd.cd_devs[unit]) == 0) {
bp->b_error = EINVAL;
goto bad;
}
@@ -1036,17 +1034,9 @@ xdstrategy(bp)
bp->b_error = EIO;
goto bad;
}
- /* short circuit zero length request */
- if (bp->b_bcount == 0)
- goto done;
-
- /* check bounds with label (disksubr.c). Determine the size of the
- * transfer, and make sure it is within the boundaries of the
- * partition. Adjust transfer if needed, and signal errors or early
- * completion. */
-
- if (bounds_check_with_label(bp, xd->sc_dk.dk_label) <= 0)
+ /* Validate the request. */
+ if (bounds_check_with_label(bp, xd->sc_dk.dk_label) == -1)
goto done;
/*
@@ -1090,11 +1080,11 @@ xdstrategy(bp)
splx(s);
return;
-bad: /* tells upper layers we have an error */
+ bad: /* tells upper layers we have an error */
bp->b_flags |= B_ERROR;
-done: /* tells upper layers we are done with this
- * buf */
bp->b_resid = bp->b_bcount;
+ done: /* tells upper layers we are done with this
+ * buf */
s = splbio();
biodone(bp);
splx(s);
diff --git a/sys/arch/sparc/dev/xy.c b/sys/arch/sparc/dev/xy.c
index 071f98fc864..24dc1510bec 100644
--- a/sys/arch/sparc/dev/xy.c
+++ b/sys/arch/sparc/dev/xy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xy.c,v 1.52 2011/06/05 18:40:33 matthew Exp $ */
+/* $OpenBSD: xy.c,v 1.53 2011/07/06 04:49:35 matthew Exp $ */
/* $NetBSD: xy.c,v 1.26 1997/07/19 21:43:56 pk Exp $ */
/*
@@ -974,9 +974,7 @@ xystrategy(bp)
/* check for live device */
- if (unit >= xy_cd.cd_ndevs || (xy = xy_cd.cd_devs[unit]) == 0 ||
- bp->b_blkno < 0 ||
- (bp->b_bcount % xy->sc_dk.dk_label->d_secsize) != 0) {
+ if (unit >= xy_cd.cd_ndevs || (xy = xy_cd.cd_devs[unit]) == 0) {
bp->b_error = EINVAL;
goto bad;
}
@@ -999,17 +997,9 @@ xystrategy(bp)
bp->b_error = EIO;
goto bad;
}
- /* short circuit zero length request */
- if (bp->b_bcount == 0)
- goto done;
-
- /* check bounds with label (disksubr.c). Determine the size of the
- * transfer, and make sure it is within the boundaries of the
- * partition. Adjust transfer if needed, and signal errors or early
- * completion. */
-
- if (bounds_check_with_label(bp, xy->sc_dk.dk_label) <= 0)
+ /* Validate the request. */
+ if (bounds_check_with_label(bp, xy->sc_dk.dk_label) == -1)
goto done;
/*
@@ -1029,11 +1019,11 @@ xystrategy(bp)
splx(s);
return;
-bad: /* tells upper layers we have an error */
+ bad: /* tells upper layers we have an error */
bp->b_flags |= B_ERROR;
-done: /* tells upper layers we are done with this
- * buf */
bp->b_resid = bp->b_bcount;
+ done: /* tells upper layers we are done with this
+ * buf */
s = splbio();
biodone(bp);
splx(s);