summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorchuck <chuck@openbsd.org>1996-11-08 20:49:12 +0000
committerchuck <chuck@openbsd.org>1996-11-08 20:49:12 +0000
commit78b951338ba73e6ce93e1ee1486a526a6531c843 (patch)
treed059a31f983ca456b76cf48887a6d57542598320 /sys
parentcorrect example (diff)
downloadwireguard-openbsd-78b951338ba73e6ce93e1ee1486a526a6531c843.tar.xz
wireguard-openbsd-78b951338ba73e6ce93e1ee1486a526a6531c843.zip
apply netbsd pr#2598 from der mouse:
everything before the beginning of the "a" partition on a disk is read-only except when accessed via RAW_PART. (a problem if "a" isn't at the front of the disk).
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/mvme68k/mvme68k/disksubr.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/sys/arch/mvme68k/mvme68k/disksubr.c b/sys/arch/mvme68k/mvme68k/disksubr.c
index 66a0e2e7938..1e636cb34ff 100644
--- a/sys/arch/mvme68k/mvme68k/disksubr.c
+++ b/sys/arch/mvme68k/mvme68k/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.7 1996/05/29 16:37:17 chuck Exp $ */
+/* $OpenBSD: disksubr.c,v 1.8 1996/11/08 20:49:12 chuck Exp $ */
/*
* Copyright (c) 1995 Dale Rahn.
@@ -301,16 +301,14 @@ bounds_check_with_label(bp, lp, wlabel)
int wlabel;
{
struct partition *p = lp->d_partitions + DISKPART(bp->b_dev);
- int labelsect = lp->d_partitions[0].p_offset;
int maxsz = p->p_size;
int sz = (bp->b_bcount + DEV_BSIZE - 1) >> DEV_BSHIFT;
/* overwriting disk label ? */
/* XXX should also protect bootstrap in first 8K */
- if (bp->b_blkno + p->p_offset <= LABELSECTOR + labelsect &&
-#if LABELSECTOR != 0
- bp->b_blkno + p->p_offset + sz > LABELSECTOR + labelsect &&
-#endif
+ /* XXX this assumes everything <=LABELSECTOR is label! */
+ /* (but since LABELSECTOR is zero, this is ok) */
+ if (bp->b_blkno + p->p_offset <= LABELSECTOR &&
(bp->b_flags & B_READ) == 0 && wlabel == 0) {
bp->b_error = EROFS;
goto bad;