git: 202f8bde836d - main - vm_page: Fix loading bad memory addresses from file

From: Romain Tartière <romain_at_FreeBSD.org>
Date: Sat, 26 Jul 2025 22:43:48 UTC
The branch main has been updated by romain:

URL: https://cgit.FreeBSD.org/src/commit/?id=202f8bde836dc86627be2b5b98174d9a0fb2eaba

commit 202f8bde836dc86627be2b5b98174d9a0fb2eaba
Author:     Romain Tartière <romain@FreeBSD.org>
AuthorDate: 2025-07-25 18:31:57 +0000
Commit:     Romain Tartière <romain@FreeBSD.org>
CommitDate: 2025-07-26 22:43:27 +0000

    vm_page: Fix loading bad memory addresses from file
    
    When loading bad memory addresses from a file, we are passed an end
    pointer that points on the first byte after the buffer. We want the
    buffer to be null-terminated (by changing the last byte to \0 if it is
    reasonable to do so), so adjust the end pointer to be on that byte.
    
    Approved by:    kib, markj
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D51433
---
 sys/vm/vm_page.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index bbae55895c2c..b239a6ffb4ce 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -396,7 +396,7 @@ vm_page_blacklist_load(char **list, char **end)
         }
 	*list = ptr;
 	if (ptr != NULL)
-		*end = ptr + len;
+		*end = ptr + len - 1;
 	else
 		*end = NULL;
 	return;