svn commit: r259299 - stable/10/sys/vm

Konstantin Belousov kib at FreeBSD.org
Fri Dec 13 06:28:19 UTC 2013


Author: kib
Date: Fri Dec 13 06:28:18 2013
New Revision: 259299
URL: http://svnweb.freebsd.org/changeset/base/259299

Log:
  MFC r258367:
  Verify for zero-length requests and act as if it is always successfull
  without performing any action on the address space.

Modified:
  stable/10/sys/vm/vm_map.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/vm/vm_map.c
==============================================================================
--- stable/10/sys/vm/vm_map.c	Fri Dec 13 06:25:43 2013	(r259298)
+++ stable/10/sys/vm/vm_map.c	Fri Dec 13 06:28:18 2013	(r259299)
@@ -1876,6 +1876,9 @@ vm_map_protect(vm_map_t map, vm_offset_t
 	struct ucred *cred;
 	vm_prot_t old_prot;
 
+	if (start == end)
+		return (KERN_SUCCESS);
+
 	vm_map_lock(map);
 
 	VM_MAP_RANGE_CHECK(map, start, end);
@@ -2030,12 +2033,16 @@ vm_map_madvise(
 	case MADV_AUTOSYNC:
 	case MADV_NOCORE:
 	case MADV_CORE:
+		if (start == end)
+			return (KERN_SUCCESS);
 		modify_map = 1;
 		vm_map_lock(map);
 		break;
 	case MADV_WILLNEED:
 	case MADV_DONTNEED:
 	case MADV_FREE:
+		if (start == end)
+			return (KERN_SUCCESS);
 		vm_map_lock_read(map);
 		break;
 	default:
@@ -2190,6 +2197,8 @@ vm_map_inherit(vm_map_t map, vm_offset_t
 	default:
 		return (KERN_INVALID_ARGUMENT);
 	}
+	if (start == end)
+		return (KERN_SUCCESS);
 	vm_map_lock(map);
 	VM_MAP_RANGE_CHECK(map, start, end);
 	if (vm_map_lookup_entry(map, start, &temp_entry)) {
@@ -2222,6 +2231,8 @@ vm_map_unwire(vm_map_t map, vm_offset_t 
 	int rv;
 	boolean_t need_wakeup, result, user_unwire;
 
+	if (start == end)
+		return (KERN_SUCCESS);
 	user_unwire = (flags & VM_MAP_WIRE_USER) ? TRUE : FALSE;
 	vm_map_lock(map);
 	VM_MAP_RANGE_CHECK(map, start, end);
@@ -2392,6 +2403,8 @@ vm_map_wire(vm_map_t map, vm_offset_t st
 	boolean_t fictitious, need_wakeup, result, user_wire;
 	vm_prot_t prot;
 
+	if (start == end)
+		return (KERN_SUCCESS);
 	prot = 0;
 	if (flags & VM_MAP_WIRE_WRITE)
 		prot |= VM_PROT_WRITE;
@@ -2833,6 +2846,8 @@ vm_map_delete(vm_map_t map, vm_offset_t 
 	vm_map_entry_t first_entry;
 
 	VM_MAP_ASSERT_LOCKED(map);
+	if (start == end)
+		return (KERN_SUCCESS);
 
 	/*
 	 * Find the start of the region, and clip it


More information about the svn-src-stable-10 mailing list