git: 603270b4d69e - main - loader.efi: Fix off by one error in size of the virtual disk

From: Warner Losh <imp_at_FreeBSD.org>
Date: Fri, 10 Jul 2026 04:18:42 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=603270b4d69ecf0a8405e34bd41838873ddad72d

commit 603270b4d69ecf0a8405e34bd41838873ddad72d
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2026-07-10 04:04:30 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2026-07-10 04:09:41 +0000

    loader.efi: Fix off by one error in size of the virtual disk
    
    The end address is the final byte in the array, not one byte past the
    end of the array, so we need to add 1 to get the full length.
    
    Fixes: 59219fc76a4b ("loader.efi: efiblk_memdisk_preload passes the VirtualDisks to FreeBSD")
    Sponsored by: Netflix
    Differential Revision:  https://reviews.freebsd.org/D58069
---
 stand/efi/libefi/efipart.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/stand/efi/libefi/efipart.c b/stand/efi/libefi/efipart.c
index b4842e1b52aa..c80a3b966376 100644
--- a/stand/efi/libefi/efipart.c
+++ b/stand/efi/libefi/efipart.c
@@ -1292,7 +1292,7 @@ efiblk_memdisk_preload(void)
 		snprintf(value, sizeof(value), "0x%016x", start);
 		setenv(key, value, 1);
 		snprintf(key, sizeof(key), "hint.md.%d.len", i);
-		snprintf(value, sizeof(value), "0x%016x", end - start);
+		snprintf(value, sizeof(value), "%d", end - start + 1);
 		setenv(key, value, 1);
 	}
 }