Index: vm_mmap.c =================================================================== --- vm_mmap.c +++ vm_mmap.c @@ -257,6 +257,9 @@ /* Adjust size for rounding (on both ends). */ size += pageoff; /* low end... */ + /* Check for rounding up to zero. */ + if ((vm_size_t) round_page(size) < size) + return (EINVAL); size = (vm_size_t) round_page(size); /* hi end */ /* Ensure alignment is at least a page and fits in a pointer. */