summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_fault.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2011-03-25 16:38:10 +0000
committerkib <kib@FreeBSD.org>2011-03-25 16:38:10 +0000
commiteeb1ebf124d9c1b108ce628aa98d1af7875d3334 (patch)
treee32e00ee6351de0257ca9e2cd7d455cb4286c383 /sys/vm/vm_fault.c
parent4dc12088a11c128c9cbe74247ccb5b2a1ddb92c8 (diff)
downloadFreeBSD-src-eeb1ebf124d9c1b108ce628aa98d1af7875d3334.zip
FreeBSD-src-eeb1ebf124d9c1b108ce628aa98d1af7875d3334.tar.gz
Handle the corner case in vm_fault_quick_hold_pages().
If supplied length is zero, and user address is invalid, function might return -1, due to the truncation and rounding of the address. The callers interpret the situation as EFAULT. Instead of handling the zero length in caller, filter it in vm_fault_quick_hold_pages(). Sponsored by: The FreeBSD Foundation Reviewed by: alc
Diffstat (limited to 'sys/vm/vm_fault.c')
-rw-r--r--sys/vm/vm_fault.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c
index 43da602..d417a84 100644
--- a/sys/vm/vm_fault.c
+++ b/sys/vm/vm_fault.c
@@ -1058,6 +1058,8 @@ vm_fault_quick_hold_pages(vm_map_t map, vm_offset_t addr, vm_size_t len,
int count;
boolean_t pmap_failed;
+ if (len == 0)
+ return (0);
end = round_page(addr + len);
addr = trunc_page(addr);
OpenPOWER on IntegriCloud