summaryrefslogtreecommitdiff
path: root/sys/arch/sparc/dev
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2008-06-15 00:36:42 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2008-06-15 00:36:42 +0000
commitc74544620cbb68ee5eeb151f8179b7b75a541845 (patch)
tree690e112486687a73d36279bd6260d0c784473b24 /sys/arch/sparc/dev
parent663dcc3f9fd3820372803855330ae78840ef6eb3 (diff)
Don't bypass partition bounds check for RAW_PART. We now guarantee that
RAW_PART will always be 0 -> disksize, so the bounds check will always pass for i/o's to valid addresses. Now the i/o will be properly truncated if it goes past the end of the device. This prevents various adverse impacts of issuing i/o's for data past the end of the device. Repeatedly requested by todd@. ok weingart@ deraadt@
Diffstat (limited to 'sys/arch/sparc/dev')
-rw-r--r--sys/arch/sparc/dev/presto.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/sys/arch/sparc/dev/presto.c b/sys/arch/sparc/dev/presto.c
index 2311511d627..891205dbe40 100644
--- a/sys/arch/sparc/dev/presto.c
+++ b/sys/arch/sparc/dev/presto.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: presto.c,v 1.13 2007/06/20 18:15:47 deraadt Exp $ */
+/* $OpenBSD: presto.c,v 1.14 2008/06/15 00:36:40 krw Exp $ */
/*
* Copyright (c) 2003, Miodrag Vallat.
* All rights reserved.
@@ -276,7 +276,7 @@ prestowrite(dev_t dev, struct uio *uio, int flags)
void
prestostrategy(struct buf *bp)
{
- int unit, part;
+ int unit;
struct presto_softc *sc;
size_t offset, count;
int s;
@@ -292,9 +292,7 @@ prestostrategy(struct buf *bp)
}
/* Do not write on "no trespassing" areas... */
- part = DISKPART(bp->b_dev);
- if (part != RAW_PART &&
- bounds_check_with_label(bp, sc->sc_dk.dk_label, 1) <= 0)
+ if (bounds_check_with_label(bp, sc->sc_dk.dk_label, 1) <= 0)
goto bad;
/* Bound the request size, then move data between buf and nvram */