]> xenbits.xensource.com Git - xen.git/commitdiff
tools/livepatch: initialise j to 0 to fix compilation error in gcc 4.5
authorDongli Zhang <dongli.zhang@oracle.com>
Wed, 15 Jun 2016 13:07:53 +0000 (21:07 +0800)
committerWei Liu <wei.liu2@citrix.com>
Fri, 17 Jun 2016 10:27:21 +0000 (11:27 +0100)
Initialise j to 0 to make some versions of gcc (e.g., gcc4.5/4.3) happy to
avoid compilation error by commit beba3693f7243e68bbe31fe3794da91068eeea5b.

Failure manifests with gcc 4.5 as:

[  153s] cc1: warnings being treated as errors
[  153s] xen-livepatch.c: In function 'main':
[  153s] xen-livepatch.c:415:12: error: 'j' may be used uninitialized in this function
[  153s] make[3]: *** [xen-livepatch.o] Error 1

Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
tools/misc/xen-livepatch.c

index 316248979c79a08d516b08e843450459ee215c21..62c072ec3a0e873372f754590f4be9797c65d621 100644 (file)
@@ -412,7 +412,7 @@ struct {
 
 int main(int argc, char *argv[])
 {
-    int i, j, ret;
+    int i, j = 0, ret;
 
     if ( argc  <= 1 )
     {