tools/tests: fix an xs-test.c issue
authorWei Liu <wei.liu2@citrix.com>
Mon, 20 Aug 2018 08:38:18 +0000 (09:38 +0100)
committerWei Liu <wei.liu2@citrix.com>
Mon, 20 Aug 2018 10:50:17 +0000 (11:50 +0100)
The ret variable can be used uninitialised when iters is 0. Initialise
ret at the beginning to fix this issue.

Reported-by: Steven Haigh <netwiz@crc.id.au>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/tests/xenstore/xs-test.c

index 17d4a66b85747d515203dd8080e9dce0285a3fd4..c4c99c06617ba19811250997123f18674e6bb4ff 100644 (file)
@@ -66,7 +66,7 @@ static int call_test(struct test *tst, int iters, bool no_clock)
     char *stage = "?";
     struct timespec tp1, tp2;
     uint64_t nsec, nsec_min, nsec_max, nsec_sum;
-    int i, ret;
+    int i, ret = 0;
 
     nsec_min = -1;
     nsec_max = 0;