git: 77a0173ca956 - stable/13 - vm_page: Fix handling of empty bad memory addresses file
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 11 Aug 2025 04:52:19 UTC
The branch stable/13 has been updated by romain: URL: https://cgit.FreeBSD.org/src/commit/?id=77a0173ca956f9f765920fe8195b951c525671c4 commit 77a0173ca956f9f765920fe8195b951c525671c4 Author: Romain Tartière <romain@FreeBSD.org> AuthorDate: 2025-08-03 05:42:23 +0000 Commit: Romain Tartière <romain@FreeBSD.org> CommitDate: 2025-08-11 04:51:35 +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: marklmi@yahoo.com 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 ed43a05f0e64..60295afe71cc 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; }