svn commit: r319125 - head/usr.bin/mkimg

Emmanuel Vadot manu at FreeBSD.org
Mon May 29 12:51:03 UTC 2017


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)


More information about the svn-src-all mailing list