summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarin Ramesa <mpr@hi.t-com.hr>2013-12-17 15:58:26 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2013-12-17 18:49:23 +0100
commit68bbdd1e18a87afede6cbdffdb8c7078ed3fa835 (patch)
tree20518e5f0ed93ec4ec05a1ff09d307ac496313dd
parentb5e56770ae41abccdbc28195cc132ff3f8aa1587 (diff)
Cleanup of the copyin() and copyout() calls
* device/ds_routines.c (device_write_trap) (copyin) (data): Cast to (void *). Argument is an address. (device_write_trap) (copyin) (io_data): Don't cast. (device_writev_trap) (copyin) (iovec, stack_iovec): Likewise. (device_writev_trap) (copyin) (data, p): Cast to (void *). Arguments are addresses. * kern/bootstrap.c (build_args_and_stack) (copyout) (arg_count, string_pos, zero): Don't cast. * kern/ipc_mig.c (syscall_vm_map) (copyin, copyout) (addr, address): Likewise. (syscall_vm_allocate) (copyin, copyout) (addr, address): Likewise. (syscall_task_create) (copyout) (name, child_task): Likewise. (syscall_mach_port_allocate) (copyout) (name, namep): Likewise. * kern/time_stamp.c (copyout) (temp, tsp): Likewise.
-rw-r--r--device/ds_routines.c10
-rw-r--r--kern/bootstrap.c10
-rw-r--r--kern/ipc_mig.c12
-rw-r--r--kern/time_stamp.c4
4 files changed, 18 insertions, 18 deletions
diff --git a/device/ds_routines.c b/device/ds_routines.c
index bc22495..a68dc7a 100644
--- a/device/ds_routines.c
+++ b/device/ds_routines.c
@@ -1688,7 +1688,7 @@ device_write_trap (mach_device_t device, dev_mode_t mode,
* Copy the data from user space.
*/
if (data_count > 0)
- copyin((char *)data, (char *)ior->io_data, data_count);
+ copyin((void *)data, ior->io_data, data_count);
/*
* The ior keeps an extra reference for the device.
@@ -1735,8 +1735,8 @@ device_writev_trap (mach_device_t device, dev_mode_t mode,
*/
if (iocount > 16)
return KERN_INVALID_VALUE; /* lame */
- copyin((char *)iovec,
- (char *)stack_iovec,
+ copyin(iovec,
+ stack_iovec,
iocount * sizeof(io_buf_vec_t));
for (data_count = 0, i = 0; i < iocount; i++)
data_count += stack_iovec[i].count;
@@ -1774,8 +1774,8 @@ device_writev_trap (mach_device_t device, dev_mode_t mode,
p = (vm_offset_t) ior->io_data;
for (i = 0; i < iocount; i++) {
- copyin((char *) stack_iovec[i].data,
- (char *) p,
+ copyin((void *) stack_iovec[i].data,
+ (void *) p,
stack_iovec[i].count);
p += stack_iovec[i].count;
}
diff --git a/kern/bootstrap.c b/kern/bootstrap.c
index c0576b7..86e238a 100644
--- a/kern/bootstrap.c
+++ b/kern/bootstrap.c
@@ -587,7 +587,7 @@ build_args_and_stack(struct exec_info *boot_exec_info,
/*
* first the argument count
*/
- (void) copyout((char *)&arg_count,
+ (void) copyout(&arg_count,
arg_pos,
sizeof(integer_t));
arg_pos += sizeof(integer_t);
@@ -600,7 +600,7 @@ build_args_and_stack(struct exec_info *boot_exec_info,
arg_item_len = strlen(arg_ptr) + 1; /* include trailing 0 */
/* set string pointer */
- (void) copyout((char *)&string_pos,
+ (void) copyout(&string_pos,
arg_pos,
sizeof (char *));
arg_pos += sizeof(char *);
@@ -613,7 +613,7 @@ build_args_and_stack(struct exec_info *boot_exec_info,
/*
* Null terminator for argv.
*/
- (void) copyout((char *)&zero, arg_pos, sizeof(char *));
+ (void) copyout(&zero, arg_pos, sizeof(char *));
arg_pos += sizeof(char *);
/*
@@ -624,7 +624,7 @@ build_args_and_stack(struct exec_info *boot_exec_info,
arg_item_len = strlen(arg_ptr) + 1; /* include trailing 0 */
/* set string pointer */
- (void) copyout((char *)&string_pos,
+ (void) copyout(&string_pos,
arg_pos,
sizeof (char *));
arg_pos += sizeof(char *);
@@ -637,7 +637,7 @@ build_args_and_stack(struct exec_info *boot_exec_info,
/*
* Null terminator for envp.
*/
- (void) copyout((char *)&zero, arg_pos, sizeof(char *));
+ (void) copyout(&zero, arg_pos, sizeof(char *));
}
diff --git a/kern/ipc_mig.c b/kern/ipc_mig.c
index 3cd0f88..f5e8e14 100644
--- a/kern/ipc_mig.c
+++ b/kern/ipc_mig.c
@@ -651,12 +651,12 @@ syscall_vm_map(
} else
port = (ipc_port_t) memory_object;
- copyin((char *)address, (char *)&addr, sizeof(vm_offset_t));
+ copyin(address, &addr, sizeof(vm_offset_t));
result = vm_map(map, &addr, size, mask, anywhere,
port, offset, copy,
cur_protection, max_protection, inheritance);
if (result == KERN_SUCCESS)
- copyout((char *)&addr, (char *)address, sizeof(vm_offset_t));
+ copyout(&addr, address, sizeof(vm_offset_t));
if (IP_VALID(port))
ipc_port_release_send(port);
vm_map_deallocate(map);
@@ -678,10 +678,10 @@ kern_return_t syscall_vm_allocate(target_map, address, size, anywhere)
if (map == VM_MAP_NULL)
return MACH_SEND_INTERRUPTED;
- copyin((char *)address, (char *)&addr, sizeof(vm_offset_t));
+ copyin(address, &addr, sizeof(vm_offset_t));
result = vm_allocate(map, &addr, size, anywhere);
if (result == KERN_SUCCESS)
- copyout((char *)&addr, (char *)address, sizeof(vm_offset_t));
+ copyout(&addr, address, sizeof(vm_offset_t));
vm_map_deallocate(map);
return result;
@@ -726,7 +726,7 @@ kern_return_t syscall_task_create(parent_task, inherit_memory, child_task)
(void) ipc_kmsg_copyout_object(current_space(),
(ipc_object_t) port,
MACH_MSG_TYPE_PORT_SEND, &name);
- copyout((char *)&name, (char *)child_task,
+ copyout(&name, child_task,
sizeof(mach_port_t));
}
task_deallocate(t);
@@ -814,7 +814,7 @@ syscall_mach_port_allocate(task, right, namep)
kr = mach_port_allocate(space, right, &name);
if (kr == KERN_SUCCESS)
- copyout((char *)&name, (char *)namep, sizeof(mach_port_t));
+ copyout(&name, namep, sizeof(mach_port_t));
is_release(space);
return kr;
diff --git a/kern/time_stamp.c b/kern/time_stamp.c
index 2c14274..7f4c0f6 100644
--- a/kern/time_stamp.c
+++ b/kern/time_stamp.c
@@ -43,8 +43,8 @@ struct tsval *tsp;
time_value_t temp;
temp = time;
- if (copyout((char *)&temp,
- (char *)tsp,
+ if (copyout(&temp,
+ tsp,
sizeof(struct tsval)) != KERN_SUCCESS)
return(KERN_INVALID_ADDRESS);
return(KERN_SUCCESS);