提交 cceaeddc 编写于 作者: C Chen Gang 提交者: Matt Turner

alpha: kernel: osf_sys: Set 'kts.tv_nsec' only when 'tv' has effect

The related warning:

    CC      init/do_mounts.o
  arch/alpha/kernel/osf_sys.c: In function 'SyS_osf_settimeofday':
  arch/alpha/kernel/osf_sys.c:1028:14: warning: 'kts.tv_nsec' may be used uninitialized in this function [-Wmaybe-uninitialized]
    kts.tv_nsec *= 1000;
                ^
  arch/alpha/kernel/osf_sys.c:1016:18: note: 'kts' was declared here
    struct timespec kts;
                    ^
Signed-off-by: NChen Gang <gang.chen.5i5j@gmail.com>
Signed-off-by: NMatt Turner <mattst88@gmail.com>
上级 228fa858
...@@ -1019,14 +1019,13 @@ SYSCALL_DEFINE2(osf_settimeofday, struct timeval32 __user *, tv, ...@@ -1019,14 +1019,13 @@ SYSCALL_DEFINE2(osf_settimeofday, struct timeval32 __user *, tv,
if (tv) { if (tv) {
if (get_tv32((struct timeval *)&kts, tv)) if (get_tv32((struct timeval *)&kts, tv))
return -EFAULT; return -EFAULT;
kts.tv_nsec *= 1000;
} }
if (tz) { if (tz) {
if (copy_from_user(&ktz, tz, sizeof(*tz))) if (copy_from_user(&ktz, tz, sizeof(*tz)))
return -EFAULT; return -EFAULT;
} }
kts.tv_nsec *= 1000;
return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL); return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册