diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index e0c5e9ac7dce..ed2f808a5632 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -1554,7 +1554,7 @@ pmap_growkernel(vm_offset_t addr) /* We need a new PDP entry */ nkpg = vm_page_alloc(NULL, nkpt, VM_ALLOC_NOOBJ | VM_ALLOC_SYSTEM | VM_ALLOC_WIRED); - if (!nkpg) + if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); pmap_zero_page(nkpg); paddr = VM_PAGE_TO_PHYS(nkpg); @@ -1572,12 +1572,9 @@ pmap_growkernel(vm_offset_t addr) continue; } - /* - * This index is bogus, but out of the way - */ - nkpg = vm_page_alloc(NULL, nkpt, + nkpg = vm_page_alloc(NULL, pmap_pde_pindex(kernel_vm_end), VM_ALLOC_NOOBJ | VM_ALLOC_SYSTEM | VM_ALLOC_WIRED); - if (!nkpg) + if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); nkpt++; diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index fb46c357d75c..93e841dbcfa3 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -1619,12 +1619,9 @@ pmap_growkernel(vm_offset_t addr) continue; } - /* - * This index is bogus, but out of the way - */ - nkpg = vm_page_alloc(NULL, nkpt, + nkpg = vm_page_alloc(NULL, kernel_vm_end >> PDRSHIFT, VM_ALLOC_NOOBJ | VM_ALLOC_SYSTEM | VM_ALLOC_WIRED); - if (!nkpg) + if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); nkpt++;