aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ipc/ipc_kmsg.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ipc/ipc_kmsg.c b/ipc/ipc_kmsg.c
index 33e4d57c..1b98445d 100644
--- a/ipc/ipc_kmsg.c
+++ b/ipc/ipc_kmsg.c
@@ -2383,8 +2383,12 @@ ipc_kmsg_copyout_body(
if (!is_inline && (length != 0)) {
/* first allocate memory in the map */
+ uint64_t allocated = length;
- kr = vm_allocate(map, &addr, length, TRUE);
+ assert(sizeof(mach_port_name_t) < sizeof(mach_port_t));
+ allocated -= (sizeof(mach_port_t) - sizeof(mach_port_name_t)) * number;
+
+ kr = vm_allocate(map, &addr, allocated, TRUE);
if (kr != KERN_SUCCESS) {
ipc_kmsg_clean_body(taddr, saddr);
goto vm_copyout_failure;