The branch main has been updated by olce:

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

commit 125ef4e041fed40fed2d00b0ddd90fa0eb7b6ac3
Author:     Olivier Certner <o...@freebsd.org>
AuthorDate: 2024-11-05 08:58:26 +0000
Commit:     Olivier Certner <o...@freebsd.org>
CommitDate: 2025-02-19 14:13:21 +0000

    vm_phys_avail_check(): Check index parity, fix panic messages
    
    The passed index must be the start of a chunk in phys_avail[], so must
    be even.  Test for that and print a separate panic message.
    
    While here, fix panic messages: In one, the wrong chunk boundary was
    printed, and in another, the desired but not the actual condition was
    printed, possibly leading to confusion.
    
    Reviewed by:    markj
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D48626
---
 sys/vm/vm_phys.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/sys/vm/vm_phys.c b/sys/vm/vm_phys.c
index 0b7de1d34255..01d3d5e22eb0 100644
--- a/sys/vm/vm_phys.c
+++ b/sys/vm/vm_phys.c
@@ -1780,15 +1780,17 @@ vm_phys_avail_count(void)
 static void
 vm_phys_avail_check(int i)
 {
+       if (i % 2 != 0)
+               panic("Chunk start index %d is not even.", i);
        if (phys_avail[i] & PAGE_MASK)
                panic("Unaligned phys_avail[%d]: %#jx", i,
                    (intmax_t)phys_avail[i]);
-       if (phys_avail[i+1] & PAGE_MASK)
+       if (phys_avail[i + 1] & PAGE_MASK)
                panic("Unaligned phys_avail[%d + 1]: %#jx", i,
-                   (intmax_t)phys_avail[i]);
+                   (intmax_t)phys_avail[i + 1]);
        if (phys_avail[i + 1] < phys_avail[i])
-               panic("phys_avail[%d] start %#jx < end %#jx", i,
-                   (intmax_t)phys_avail[i], (intmax_t)phys_avail[i+1]);
+               panic("phys_avail[%d]: start %#jx > end %#jx", i,
+                   (intmax_t)phys_avail[i], (intmax_t)phys_avail[i + 1]);
 }
 
 /*

Reply via email to