[PATCH 03/34] cyclictest: always clear stop to avoid -Wmaybe-uninitialized warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



src/cyclictest/cyclictest.c: In function 'timerthread':
src/cyclictest/cyclictest.c:427:30: warning: '*((void *)&stop+8)' may be used uninitialized in this function [-Wmaybe-uninitialized]
  diff += ((int) t1.tv_nsec - (int) t2.tv_nsec) / 1000;
                              ^~~~~~~~~~~~~~~~
src/cyclictest/cyclictest.c:978:39: note: '*((void *)&stop+8)' was declared here
  struct timespec now, next, interval, stop;
                                       ^~~~
src/cyclictest/cyclictest.c:426:54: warning: 'stop.tv_sec' may be used uninitialized in this function [-Wmaybe-uninitialized]
  diff = USEC_PER_SEC * (long long)((int) t1.tv_sec - (int) t2.tv_sec);
                                                      ^~~~~~~~~~~~~~~
src/cyclictest/cyclictest.c:978:39: note: 'stop.tv_sec' was declared here
  struct timespec now, next, interval, stop;
                                       ^~~~

Signed-off-by: Tommi Rantala <tommi.t.rantala@xxxxxxxxx>
---
 src/cyclictest/cyclictest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index b6c2ab7..7cd9f29 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -1065,8 +1065,8 @@ static void *timerthread(void *param)
 	next.tv_nsec += interval.tv_nsec;
 	tsnorm(&next);
 
+	memset(&stop, 0, sizeof(stop)); /* grrr */
 	if (duration) {
-		memset(&stop, 0, sizeof(stop)); /* grrr */
 		stop = now;
 		stop.tv_sec += duration;
 	}
-- 
2.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux