git: fbff6d54da14 - main - vm_phys: Fix vm_phys_find_range() after commit 69cbb18746b6

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Fri, 14 Jun 2024 04:19:04 UTC
The branch main has been updated by markj:

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

commit fbff6d54da146e98ec2ce4ebfbb86339d4f9fa21
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-06-14 04:09:45 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-06-14 04:18:26 +0000

    vm_phys: Fix vm_phys_find_range() after commit 69cbb18746b6
    
    vm_phys_seg_paddr_to_vm_page() expects a PA that's in bounds, but
    vm_phys_find_range() purposefully returns a pointer to the end of the
    last page in a segment.
    
    Fixes:  69cbb18746b6 ("vm_phys: Add a vm_phys_seg_paddr_to_vm_page() helper")
---
 sys/vm/vm_phys.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/vm/vm_phys.c b/sys/vm/vm_phys.c
index a28b3a40691e..53e58283eb9f 100644
--- a/sys/vm/vm_phys.c
+++ b/sys/vm/vm_phys.c
@@ -1450,7 +1450,7 @@ vm_phys_find_range(vm_page_t bounds[], int segind, int domain,
 		vm_phys_lazy_init_domain(domain, false);
 #endif
 		bounds[0] = vm_phys_seg_paddr_to_vm_page(seg, pa_start);
-		bounds[1] = vm_phys_seg_paddr_to_vm_page(seg, pa_end);
+		bounds[1] = &seg->first_page[atop(pa_end - seg->start)];
 		return (seg - vm_phys_segs);
 	}
 	return (-1);