make sys_gettimeofday() use copy_to_user()
This commit is contained in:
@@ -4977,6 +4977,8 @@ SYSCALL_DECLARE(gettimeofday)
|
|||||||
struct timeval *tv = (struct timeval *)ihk_mc_syscall_arg0(ctx);
|
struct timeval *tv = (struct timeval *)ihk_mc_syscall_arg0(ctx);
|
||||||
struct syscall_request request IHK_DMA_ALIGN;
|
struct syscall_request request IHK_DMA_ALIGN;
|
||||||
struct timezone *tz = (struct timezone *)ihk_mc_syscall_arg1(ctx);
|
struct timezone *tz = (struct timezone *)ihk_mc_syscall_arg1(ctx);
|
||||||
|
struct timeval atv;
|
||||||
|
int error;
|
||||||
|
|
||||||
if (!tv && !tz) {
|
if (!tv && !tz) {
|
||||||
/* nothing to do */
|
/* nothing to do */
|
||||||
@@ -4987,17 +4989,13 @@ SYSCALL_DECLARE(gettimeofday)
|
|||||||
if (!tz && gettime_local_support) {
|
if (!tz && gettime_local_support) {
|
||||||
update_cpu_local_time();
|
update_cpu_local_time();
|
||||||
|
|
||||||
/* Check validity of argument */
|
atv.tv_sec = cpu_local_var(tv_sec);
|
||||||
if (!lookup_process_memory_range(cpu_local_var(current)->vm,
|
atv.tv_usec = cpu_local_var(tv_nsec) / 1000;
|
||||||
(unsigned long)tv, (unsigned long)tv + sizeof(*tv))) {
|
|
||||||
return -EFAULT;
|
|
||||||
}
|
|
||||||
|
|
||||||
tv->tv_sec = cpu_local_var(tv_sec);
|
error = copy_to_user(tv, &atv, sizeof(atv));
|
||||||
tv->tv_usec = cpu_local_var(tv_nsec) / 1000;
|
|
||||||
|
|
||||||
dkprintf("gettimeofday(): \n");
|
dkprintf("gettimeofday(): %d\n", error);
|
||||||
return 0;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Otherwise offload */
|
/* Otherwise offload */
|
||||||
|
|||||||
Reference in New Issue
Block a user