diff options
-rw-r--r-- | sys/vm/vm_phys.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/vm/vm_phys.c b/sys/vm/vm_phys.c index d8fe232..14960c8 100644 --- a/sys/vm/vm_phys.c +++ b/sys/vm/vm_phys.c @@ -551,7 +551,9 @@ vm_phys_fictitious_reg_range(vm_paddr_t start, vm_paddr_t end, #ifdef VM_PHYSSEG_DENSE pi = atop(start); - if (pi >= first_page && atop(end) < vm_page_array_size) { + if (pi >= first_page && pi < vm_page_array_size + first_page) { + if (atop(end) >= vm_page_array_size + first_page) + return (EINVAL); fp = &vm_page_array[pi - first_page]; malloced = FALSE; } else |