summaryrefslogtreecommitdiff
path: root/vm
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2012-11-20 23:17:12 +0000
committerRichard Braun <rbraun@sceen.net>2012-11-20 23:17:12 +0000
commit7aa475db4ce168401167dc2ffed6221493ae2db4 (patch)
tree553790cd9090fa49e1bba3cbdade93bdacafd012 /vm
parentbdae52f1465743ad96b2261e053ae4967f807557 (diff)
Fix calls to vm_map when size is 0
* vm/vm_map.c (vm_map_enter): return KERN_INVALID_ARGUMENT if size is 0. * vm/vm_user.c (vm_map): Likewise.
Diffstat (limited to 'vm')
-rw-r--r--vm/vm_map.c3
-rw-r--r--vm/vm_user.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/vm/vm_map.c b/vm/vm_map.c
index c46afc0..22fa836 100644
--- a/vm/vm_map.c
+++ b/vm/vm_map.c
@@ -784,6 +784,9 @@ kern_return_t vm_map_enter(
#define RETURN(value) { result = value; goto BailOut; }
+ if (size == 0)
+ return KERN_INVALID_ARGUMENT;
+
StartAgain: ;
start = *address;
diff --git a/vm/vm_user.c b/vm/vm_user.c
index a8ce982..6fe398e 100644
--- a/vm/vm_user.c
+++ b/vm/vm_user.c
@@ -342,6 +342,9 @@ kern_return_t vm_map(
return(KERN_INVALID_ARGUMENT);
}
+ if (size == 0)
+ return KERN_INVALID_ARGUMENT;
+
*address = trunc_page(*address);
size = round_page(size);