diff options
-rw-r--r-- | sys/arch/hp300/hp300/disksubr.c | 16 | ||||
-rw-r--r-- | sys/arch/luna88k/luna88k/disksubr.c | 20 | ||||
-rw-r--r-- | sys/arch/mvme68k/mvme68k/disksubr.c | 24 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/disksubr.c | 24 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/disksubr.c | 22 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/disksubr.c | 22 | ||||
-rw-r--r-- | sys/arch/vax/vax/disksubr.c | 16 |
7 files changed, 72 insertions, 72 deletions
diff --git a/sys/arch/hp300/hp300/disksubr.c b/sys/arch/hp300/hp300/disksubr.c index a4d6e45642c..64f0be6fdff 100644 --- a/sys/arch/hp300/hp300/disksubr.c +++ b/sys/arch/hp300/hp300/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.30 2007/06/05 00:38:15 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.31 2007/06/05 02:38:36 krw Exp $ */ /* $NetBSD: disksubr.c,v 1.9 1997/04/01 03:12:13 scottr Exp $ */ /* @@ -244,13 +244,6 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, goto bad; } - /* Overwriting disk label? */ - if (bp->b_blkno + blockpersec(DL_GETPOFFSET(p), lp) <= labelsector && - (bp->b_flags & B_READ) == 0 && !wlabel) { - 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; @@ -267,6 +260,13 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, /* Otherwise, truncate request. */ bp->b_bcount = sz << DEV_BSHIFT; } + + /* Overwriting disk label? */ + if (bp->b_blkno + blockpersec(DL_GETPOFFSET(p), lp) <= labelsector && + (bp->b_flags & B_READ) == 0 && !wlabel) { + 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)) / 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; diff --git a/sys/arch/mvme68k/mvme68k/disksubr.c b/sys/arch/mvme68k/mvme68k/disksubr.c index be1748bb260..481689a60aa 100644 --- a/sys/arch/mvme68k/mvme68k/disksubr.c +++ b/sys/arch/mvme68k/mvme68k/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.43 2007/06/05 00:38:17 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.44 2007/06/05 02:38:37 krw Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1995 Dale Rahn. @@ -270,17 +270,6 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, goto bad; } - /* overwriting disk label ? */ - /* XXX should also protect bootstrap in first 8K */ - if (bp->b_blkno + blockpersec(DL_GETPOFFSET(p), lp) <= labelsector && -#if LABELSECTOR != 0 - bp->b_blkno + blockpersec(DL_GETPOFFSET(p), lp) + sz > labelsector && -#endif - (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; @@ -298,6 +287,17 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, bp->b_bcount = sz << DEV_BSHIFT; } + /* overwriting disk label ? */ + /* XXX should also protect bootstrap in first 8K */ + if (bp->b_blkno + blockpersec(DL_GETPOFFSET(p), lp) <= labelsector && +#if LABELSECTOR != 0 + bp->b_blkno + blockpersec(DL_GETPOFFSET(p), lp) + sz > labelsector && +#endif + (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; diff --git a/sys/arch/mvme88k/mvme88k/disksubr.c b/sys/arch/mvme88k/mvme88k/disksubr.c index 21cebb280b7..0432df2d2c5 100644 --- a/sys/arch/mvme88k/mvme88k/disksubr.c +++ b/sys/arch/mvme88k/mvme88k/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.39 2007/06/05 00:38:17 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.40 2007/06/05 02:38:37 krw Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1995 Dale Rahn. @@ -267,17 +267,6 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, goto bad; } - /* overwriting disk label ? */ - /* XXX should also protect bootstrap in first 8K */ - if (bp->b_blkno + blockpersec(DL_GETPOFFSET(p), lp) <= labelsector && -#if LABELSECTOR != 0 - bp->b_blkno + blockpersec(DL_GETPOFFSET(p), lp) + sz > labelsector && -#endif - (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; @@ -295,6 +284,17 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, bp->b_bcount = sz << DEV_BSHIFT; } + /* overwriting disk label ? */ + /* XXX should also protect bootstrap in first 8K */ + if (bp->b_blkno + blockpersec(DL_GETPOFFSET(p), lp) <= labelsector && +#if LABELSECTOR != 0 + bp->b_blkno + blockpersec(DL_GETPOFFSET(p), lp) + sz > labelsector && +#endif + (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; diff --git a/sys/arch/sparc/sparc/disksubr.c b/sys/arch/sparc/sparc/disksubr.c index 50d42e00009..52d93f284a6 100644 --- a/sys/arch/sparc/sparc/disksubr.c +++ b/sys/arch/sparc/sparc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.49 2007/06/05 00:38:18 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.50 2007/06/05 02:38:37 krw Exp $ */ /* $NetBSD: disksubr.c,v 1.16 1996/04/28 20:25:59 thorpej Exp $ */ /* @@ -296,16 +296,6 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, goto bad; } - /* overwriting disk label ? */ - /* XXX should also protect bootstrap in first 8K */ - /* 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; @@ -323,6 +313,16 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, bp->b_bcount = sz << DEV_BSHIFT; } + /* overwriting disk label ? */ + /* XXX should also protect bootstrap in first 8K */ + /* 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; diff --git a/sys/arch/sparc64/sparc64/disksubr.c b/sys/arch/sparc64/sparc64/disksubr.c index 33aeda7dcae..3d81c93090a 100644 --- a/sys/arch/sparc64/sparc64/disksubr.c +++ b/sys/arch/sparc64/sparc64/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.28 2007/06/05 00:38:19 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.29 2007/06/05 02:38:37 krw Exp $ */ /* $NetBSD: disksubr.c,v 1.13 2000/12/17 22:39:18 pk Exp $ */ /* @@ -293,16 +293,6 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, goto bad; } - /* overwriting disk label ? */ - /* XXX should also protect bootstrap in first 8K */ - /* 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; @@ -320,6 +310,16 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, bp->b_bcount = sz << DEV_BSHIFT; } + /* overwriting disk label ? */ + /* XXX should also protect bootstrap in first 8K */ + /* 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; diff --git a/sys/arch/vax/vax/disksubr.c b/sys/arch/vax/vax/disksubr.c index 3f62f6c26c3..be54a5f28c4 100644 --- a/sys/arch/vax/vax/disksubr.c +++ b/sys/arch/vax/vax/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.40 2007/06/05 00:38:19 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.41 2007/06/05 02:38:37 krw Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1999/06/30 18:48:06 ragge Exp $ */ /* @@ -70,13 +70,6 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, goto bad; } - /* overwriting disk label ? */ - if (bp->b_blkno + DL_GETPOFFSET(p) <= LABELSECTOR + labelsector && - (bp->b_flags & B_READ) == 0 && wlabel == 0) { - bp->b_error = EROFS; - goto bad; - } - /* beyond partition? */ if (bp->b_blkno < 0 || bp->b_blkno + sz > maxsz) { /* if exactly at end of disk, return EOF. */ @@ -94,6 +87,13 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, bp->b_bcount = sz << DEV_BSHIFT; } + /* overwriting disk label ? */ + if (bp->b_blkno + DL_GETPOFFSET(p) <= LABELSECTOR + 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 + DL_GETPOFFSET(p)) / lp->d_secpercyl; return (1); |