From: krw Date: Mon, 19 Oct 2015 19:07:59 +0000 (+0000) Subject: LABELSECTOR is a DEV_BSIZE quantity. So multiply by DEV_BSIZE and not X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=569d6d7e143566e688d9551b6b7af2a1aaf75214;p=openbsd LABELSECTOR is a DEV_BSIZE quantity. So multiply by DEV_BSIZE and not d_secsize when calculating disklabel location. ok jsing@ --- 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 @@ -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)