All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] alpha: kernel: osf_sys: Set 'kts.tv_nsec' only when 'tv' has effect
@ 2015-05-18  4:37 Chen Gang
  0 siblings, 0 replies; only message in thread
From: Chen Gang @ 2015-05-18  4:37 UTC (permalink / raw)
  To: Richard Henderson, rth, mattst88
  Cc: viro, waydi1, miklos, linux-alpha, linux-kernel

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: Chen Gang <gang.chen.5i5j@gmail.com>
---
 arch/alpha/kernel/osf_sys.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index e51f578..36dc91a 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -1019,14 +1019,13 @@ SYSCALL_DEFINE2(osf_settimeofday, struct timeval32 __user *, tv,
  	if (tv) {
 		if (get_tv32((struct timeval *)&kts, tv))
 			return -EFAULT;
+		kts.tv_nsec *= 1000;
 	}
 	if (tz) {
 		if (copy_from_user(&ktz, tz, sizeof(*tz)))
 			return -EFAULT;
 	}
 
-	kts.tv_nsec *= 1000;
-
 	return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL);
 }
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-05-18  4:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-18  4:37 [PATCH] alpha: kernel: osf_sys: Set 'kts.tv_nsec' only when 'tv' has effect Chen Gang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.