diff mbox series

[ovs-dev,v2,1/3] dpif-netdev-perf: Fix using of unitialized last_tsc

Message ID 1575602773-11901-2-git-send-email-Lance.Yang@arm.com
State Accepted
Headers show
Series Fix issues and enable Travis CI on arm | expand

Commit Message

Lance Yang Dec. 6, 2019, 3:26 a.m. UTC
When compiling Open vSwitch on aarch64, the compiler will warn about
an uninitailized variable in lib/dpif-netdev-perf.c. If the clock_gettime
function in rdtsc_syscall fails, the member last_tsc of the unitialized
struct will be returned. In order to avoid the warnings, it is necessary to
initialize the variable before using.

Reviewed-by: Yanqin Wei <Yanqin.Wei@arm.com>
Reviewed-by: Malvika Gupta <Malvika.Gupta@arm.com>
Signed-off-by: Lance Yang <Lance.Yang@arm.com>
---
 lib/dpif-netdev-perf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/lib/dpif-netdev-perf.c b/lib/dpif-netdev-perf.c
index baf90b0..58728ab 100644
--- a/lib/dpif-netdev-perf.c
+++ b/lib/dpif-netdev-perf.c
@@ -76,7 +76,7 @@  pmd_perf_estimate_tsc_frequency(void)
             break;
         }
     }
-
+    memset(&s, 0, sizeof s);
     start = cycles_counter_update(&s);
     /* Using xnanosleep as it's interrupt resistant.
      * Sleeping only 100 ms to avoid holding the main thread for too long. */