From 6b14aecae7e1986ea9998f8705f06fa8116fb89a Mon Sep 17 00:00:00 2001 From: Emmanuel Vadot Date: Mon, 29 May 2017 12:51:02 +0000 Subject: [PATCH] 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 --- usr.bin/mkimg/gpt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/mkimg/gpt.c b/usr.bin/mkimg/gpt.c index cb92a02c74af..44225ecd3821 100644 --- a/usr.bin/mkimg/gpt.c +++ b/usr.bin/mkimg/gpt.c @@ -152,7 +152,7 @@ gpt_write_pmbr(lba_t blks, void *bootcode) 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)