summaryrefslogtreecommitdiff
path: root/sys/arch/luna88k
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2007-06-05 02:38:38 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2007-06-05 02:38:38 +0000
commitd8edefa5943c6e4c14718b08e96bb6b84856f2e7 (patch)
treeb59258d91c84e69109019b4e996385e7f5dcf3c7 /sys/arch/luna88k
parent27424f98f99646fb8b3e4ef11652da62014a7ceb (diff)
bounds_check_with_label() checks for i/o outside of the partition and
for overwriting the disklabel. Reorder some checks so all copies of bounds_check_with_label do the checks in the same order. Order picked by using the currently most popular one. Should be no functional change. "If it's boring, commit it" deraadt@
Diffstat (limited to 'sys/arch/luna88k')
-rw-r--r--sys/arch/luna88k/luna88k/disksubr.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/sys/arch/luna88k/luna88k/disksubr.c b/sys/arch/luna88k/luna88k/disksubr.c
index c0516604eed..8ff3bb18ac7 100644
--- a/sys/arch/luna88k/luna88k/disksubr.c
+++ b/sys/arch/luna88k/luna88k/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.15 2007/06/05 00:38:16 deraadt Exp $ */
+/* $OpenBSD: disksubr.c,v 1.16 2007/06/05 02:38:36 krw Exp $ */
/* $NetBSD: disksubr.c,v 1.12 2002/02/19 17:09:44 wiz Exp $ */
/*
@@ -319,15 +319,6 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp,
goto bad;
}
- /* overwriting disk label ? */
- /* XXX this assumes everything <=LABELSECTOR is label! */
- /* But since LABELSECTOR is 0, that's ok for now. */
- if (bp->b_blkno + blockpersec(DL_GETPOFFSET(p), lp) <= LABELSECTOR &&
- (bp->b_flags & B_READ) == 0 && wlabel == 0) {
- bp->b_error = EROFS;
- goto bad;
- }
-
/* beyond partition? */
if (bp->b_blkno + sz > blockpersec(DL_GETPSIZE(p), lp)) {
sz = blockpersec(DL_GETPSIZE(p), lp) - bp->b_blkno;
@@ -345,6 +336,15 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp,
bp->b_bcount = sz << DEV_BSHIFT;
}
+ /* overwriting disk label ? */
+ /* XXX this assumes everything <=LABELSECTOR is label! */
+ /* But since LABELSECTOR is 0, that's ok for now. */
+ if (bp->b_blkno + blockpersec(DL_GETPOFFSET(p), lp) <= LABELSECTOR &&
+ (bp->b_flags & B_READ) == 0 && wlabel == 0) {
+ bp->b_error = EROFS;
+ goto bad;
+ }
+
/* calculate cylinder for disksort to order transfers with */
bp->b_cylinder = (bp->b_blkno + blockpersec(DL_GETPOFFSET(p), lp)) /
lp->d_secpercyl;