git: 501e1152d2a0 - stable/14 - linuxkpi: Fix an assertion in linux_free_kmem()

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Tue, 24 Oct 2023 13:38:27 UTC
The branch stable/14 has been updated by markj:

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

commit 501e1152d2a047f8ff8fba6e6efbd2d5e9872738
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2023-10-18 13:43:02 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-10-24 13:20:12 +0000

    linuxkpi: Fix an assertion in linux_free_kmem()
    
    In the LinuxKPI, PAGE_MASK is the logical negation of FreeBSD's
    PAGE_MASK, so the original assertion was simply incorrect.
    
    Reported by:    trasz
    Tested by:      trasz
    Fixes:          6223d0b67af9 ("linuxkpi: Handle direct-mapped addresses in linux_free_kmem()")
    
    (cherry picked from commit f88bd1174aab1aff7fea7241ab6e103e769d2d7a)
---
 sys/compat/linuxkpi/common/src/linux_page.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/compat/linuxkpi/common/src/linux_page.c b/sys/compat/linuxkpi/common/src/linux_page.c
index 21e338acb089..ead2f24cf5df 100644
--- a/sys/compat/linuxkpi/common/src/linux_page.c
+++ b/sys/compat/linuxkpi/common/src/linux_page.c
@@ -193,7 +193,7 @@ linux_alloc_kmem(gfp_t flags, unsigned int order)
 void
 linux_free_kmem(vm_offset_t addr, unsigned int order)
 {
-	KASSERT((addr & PAGE_MASK) == 0,
+	KASSERT((addr & ~PAGE_MASK) == 0,
 	    ("%s: addr %p is not page aligned", __func__, (void *)addr));
 
 	if (addr >= VM_MIN_KERNEL_ADDRESS && addr < VM_MAX_KERNEL_ADDRESS) {