summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_disk.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2009-06-14 00:09:37 +0000
committerderaadt <deraadt@openbsd.org>2009-06-14 00:09:37 +0000
commit6336b7dd9a2796fc111c101d76789f7695bdd34b (patch)
tree1eefe4706aab1a6af2a71a87b13732c6c6597ee2 /sys/kern/subr_disk.c
parentEnumerate all available nodes for hardware on IP27/IP35 systems; works to some (diff)
downloadwireguard-openbsd-6336b7dd9a2796fc111c101d76789f7695bdd34b.tar.xz
wireguard-openbsd-6336b7dd9a2796fc111c101d76789f7695bdd34b.zip
Don't mess with the bounds in the lp if *partoffp is non-NULL, since this
indicates that writedisklabel is trying to find the location for writing the label. If the lp is messed with, an invalid checksum is written. done with miod and kettenis, lots of moaning and gnashing of teeth, etc
Diffstat (limited to 'sys/kern/subr_disk.c')
-rw-r--r--sys/kern/subr_disk.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c
index 2508c186ce1..d33a152d299 100644
--- a/sys/kern/subr_disk.c
+++ b/sys/kern/subr_disk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_disk.c,v 1.93 2009/06/05 00:41:13 deraadt Exp $ */
+/* $OpenBSD: subr_disk.c,v 1.94 2009/06/14 00:09:40 deraadt Exp $ */
/* $NetBSD: subr_disk.c,v 1.17 1996/03/16 23:17:08 christos Exp $ */
/*
@@ -575,16 +575,18 @@ donot:
lp->d_partitions['i' - 'a'].p_fstype = FS_MSDOS;
}
notfat:
- DL_SETBSTART(lp, dospartoff);
- DL_SETBEND(lp, dospartend < DL_GETDSIZE(lp) ? dospartend : DL_GETDSIZE(lp));
-
/* record the OpenBSD partition's placement for the caller */
if (partoffp)
*partoffp = dospartoff;
+ else {
+ DL_SETBSTART(lp, dospartoff);
+ DL_SETBEND(lp,
+ dospartend < DL_GETDSIZE(lp) ? dospartend : DL_GETDSIZE(lp));
+ }
/* don't read the on-disk label if we are in spoofed-only mode */
if (spoofonly)
- return (NULL);
+ return (NULL); /* jump to the checkdisklabel below?? */
bp->b_blkno = DL_BLKTOSEC(lp, dospartoff + DOS_LABELSECTOR) *
DL_BLKSPERSEC(lp);