Commit 9735860f authored by Andi Kleen's avatar Andi Kleen Committed by Linus Torvalds

[PATCH] Fix typo in timing changes + support for x86-64

The us->ns conversion must be in the "tv" if branch of settimeofday,
not in the "tz" if.

Also make it compile for x86-64 again. The 32bit emulation was forgotten
in the conversion.
parent c202927c
...@@ -452,7 +452,6 @@ sys32_alarm(unsigned int seconds) ...@@ -452,7 +452,6 @@ sys32_alarm(unsigned int seconds)
sorts of things, like timeval and itimerval. */ sorts of things, like timeval and itimerval. */
extern struct timezone sys_tz; extern struct timezone sys_tz;
extern int do_sys_settimeofday(struct timeval *tv, struct timezone *tz);
asmlinkage long asmlinkage long
sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz) sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz)
...@@ -474,18 +473,21 @@ asmlinkage long ...@@ -474,18 +473,21 @@ asmlinkage long
sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz) sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz)
{ {
struct timeval ktv; struct timeval ktv;
struct timespec kts;
struct timezone ktz; struct timezone ktz;
if (tv) { if (tv) {
if (get_tv32(&ktv, tv)) if (get_tv32(&ktv, tv))
return -EFAULT; return -EFAULT;
kts.tv_sec = ktv.tv_sec;
kts.tv_nsec = ktv.tv_usec * NSEC_PER_USEC;
} }
if (tz) { if (tz) {
if (copy_from_user(&ktz, tz, sizeof(ktz))) if (copy_from_user(&ktz, tz, sizeof(ktz)))
return -EFAULT; return -EFAULT;
} }
return do_sys_settimeofday(tv ? &ktv : NULL, tz ? &ktz : NULL); return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL);
} }
struct linux32_dirent { struct linux32_dirent {
......
...@@ -168,11 +168,11 @@ asmlinkage long sys_settimeofday(struct timeval __user *tv, struct timezone __us ...@@ -168,11 +168,11 @@ asmlinkage long sys_settimeofday(struct timeval __user *tv, struct timezone __us
if (tv) { if (tv) {
if (copy_from_user(&new_tv, tv, sizeof(*tv))) if (copy_from_user(&new_tv, tv, sizeof(*tv)))
return -EFAULT; return -EFAULT;
new_tv.tv_nsec *= NSEC_PER_USEC;
} }
if (tz) { if (tz) {
if (copy_from_user(&new_tz, tz, sizeof(*tz))) if (copy_from_user(&new_tz, tz, sizeof(*tz)))
return -EFAULT; return -EFAULT;
new_tv.tv_nsec *= NSEC_PER_USEC;
} }
return do_sys_settimeofday(tv ? &new_tv : NULL, tz ? &new_tz : NULL); return do_sys_settimeofday(tv ? &new_tv : NULL, tz ? &new_tz : NULL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment