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)
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to