svn commit: r220001 - head/sys/vm

Konstantin Belousov kib at FreeBSD.org
Fri Mar 25 16:38:10 UTC 2011


Author: kib
Date: Fri Mar 25 16:38:10 2011
New Revision: 220001
URL: http://svn.freebsd.org/changeset/base/220001

Log:
  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

Modified:
  head/sys/vm/vm_fault.c

Modified: head/sys/vm/vm_fault.c
==============================================================================
--- head/sys/vm/vm_fault.c	Fri Mar 25 14:01:18 2011	(r220000)
+++ head/sys/vm/vm_fault.c	Fri Mar 25 16:38:10 2011	(r220001)
@@ -1058,6 +1058,8 @@ vm_fault_quick_hold_pages(vm_map_t map, 
 	int count;
 	boolean_t pmap_failed;
 
+	if (len == 0)
+		return (0);
 	end = round_page(addr + len);	
 	addr = trunc_page(addr);
 


More information about the svn-src-all mailing list