The branch stable/14 has been updated by romain: URL: https://cgit.FreeBSD.org/src/commit/?id=aa326b970e36d063abc653071ca5fccdf83e5554
commit aa326b970e36d063abc653071ca5fccdf83e5554 Author: Romain Tartière <[email protected]> AuthorDate: 2025-08-03 05:42:23 +0000 Commit: Romain Tartière <[email protected]> CommitDate: 2025-08-11 04:50:54 +0000 vm_page: Fix handling of empty bad memory addresses file If a file with bad memory addresses is configured but that file is empty (0 lines, 0 bytes), when loading it we end up returning an end pointer that is just _before_ the start of the (empty) file content. Adjust the code to make it clear what pre-condition are required to set the *list / *end pointers correctly, and explicitly set them to NULL when they are not matched. Reported by: [email protected] Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D51717 (cherry picked from commit f90940ce6eb71df40538c35a65d77ad3093c679a) --- sys/vm/vm_page.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index f013cbc84c25..1da7ddce86a6 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -391,11 +391,15 @@ vm_page_blacklist_load(char **list, char **end) ptr = preload_fetch_addr(mod); len = preload_fetch_size(mod); } - *list = ptr; - if (ptr != NULL) + + if (ptr != NULL && len > 0) { + *list = ptr; *end = ptr + len - 1; - else + } else { + *list = NULL; *end = NULL; + } + return; }
