summaryrefslogtreecommitdiffstats
path: root/usr.sbin/installboot/bootstrap.c
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2015-10-19 19:07:59 +0000
committerkrw <krw@openbsd.org>2015-10-19 19:07:59 +0000
commit569d6d7e143566e688d9551b6b7af2a1aaf75214 (patch)
tree1e69e342c7d001ad56389f69c90d071e08fa1cc4 /usr.sbin/installboot/bootstrap.c
parentNuke unused variable. (diff)
downloadwireguard-openbsd-569d6d7e143566e688d9551b6b7af2a1aaf75214.tar.xz
wireguard-openbsd-569d6d7e143566e688d9551b6b7af2a1aaf75214.zip
LABELSECTOR is a DEV_BSIZE quantity. So multiply by DEV_BSIZE and not
d_secsize when calculating disklabel location. ok jsing@
Diffstat (limited to 'usr.sbin/installboot/bootstrap.c')
-rw-r--r--usr.sbin/installboot/bootstrap.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.sbin/installboot/bootstrap.c b/usr.sbin/installboot/bootstrap.c
index adabff3767a..6de5babd100 100644
--- a/usr.sbin/installboot/bootstrap.c
+++ b/usr.sbin/installboot/bootstrap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bootstrap.c,v 1.7 2015/10/15 19:27:30 miod Exp $ */
+/* $OpenBSD: bootstrap.c,v 1.8 2015/10/19 19:07:59 krw Exp $ */
/*
* Copyright (c) 2013 Joel Sing <jsing@openbsd.org>
@@ -106,8 +106,11 @@ bootstrap(int devfd, char *dev, char *bootfile, unsigned int overlap_allowance)
}
}
- /* Make sure the bootstrap has left space for the disklabel. */
- lp = (struct disklabel *)(boot + (LABELSECTOR * dl.d_secsize) +
+ /*
+ * Make sure the bootstrap has left space for the disklabel.
+ * N.B.: LABELSECTOR *is* a DEV_BSIZE quantity!
+ */
+ lp = (struct disklabel *)(boot + (LABELSECTOR * DEV_BSIZE) +
LABELOFFSET);
for (i = 0, p = (char *)lp; i < (int)sizeof(*lp); i++)
if (p[i] != 0)