Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 May 2017 12:51:02 +0000 (UTC)
From:      Emmanuel Vadot <manu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r319125 - head/usr.bin/mkimg
Message-ID:  <201705291251.v4TCp24h090283@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: manu
Date: Mon May 29 12:51:02 2017
New Revision: 319125
URL: https://svnweb.freebsd.org/changeset/base/319125

Log:
  mkimg: Correct an off by one error in the PMBR size
  
  The PMBR last sector should be number of sector - 1 (As stated in UEFI Spec
  2.6 page 118 table 17).
  This fixes warning printed by linux tools like parted or fdisk.
  
  Sponsored by:	Gandi.net

Modified:
  head/usr.bin/mkimg/gpt.c

Modified: head/usr.bin/mkimg/gpt.c
==============================================================================
--- head/usr.bin/mkimg/gpt.c	Mon May 29 11:37:08 2017	(r319124)
+++ head/usr.bin/mkimg/gpt.c	Mon May 29 12:51:02 2017	(r319125)
@@ -152,7 +152,7 @@ gpt_write_pmbr(lba_t blks, void *bootcod
 	uint32_t secs;
 	int error;
 
-	secs = (blks > UINT32_MAX) ? UINT32_MAX : (uint32_t)blks;
+	secs = (blks > UINT32_MAX) ? UINT32_MAX : (uint32_t)blks - 1;
 
 	pmbr = malloc(secsz);
 	if (pmbr == NULL)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201705291251.v4TCp24h090283>