Correct the range boundaries used by kern_mincore().

Reported by:	alc
Sponsored by:	Netflix
This commit is contained in:
Mark Johnston 2019-10-16 21:47:58 +00:00
parent 96448820a3
commit d0c9294b81

View File

@ -800,7 +800,7 @@ kern_mincore(struct thread *td, uintptr_t addr0, size_t len, char *vec)
* mode.
*/
first_addr = addr = trunc_page(addr0);
end = addr + (vm_size_t)round_page(len);
end = round_page(addr0 + len);
map = &td->td_proc->p_vmspace->vm_map;
if (end > vm_map_max(map) || end < addr)
return (ENOMEM);