diff mbox

[1/1] tools/livepatch: initialise j to 0 to make some versions of gcc happy

Message ID 1465996073-2739-1-git-send-email-dongli.zhang@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dongli Zhang June 15, 2016, 1:07 p.m. UTC
Initialise j to 0 to make some versions of gcc (e.g., gcc4.5/4.3) happy to
avoid compilation error by commit beba3693f7243e68bbe31fe3794da91068eeea5b.

Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
---
 tools/misc/xen-livepatch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Wei Liu June 16, 2016, 8:49 a.m. UTC | #1
On Wed, Jun 15, 2016 at 09:07:53PM +0800, Dongli Zhang wrote:
> Initialise j to 0 to make some versions of gcc (e.g., gcc4.5/4.3) happy to
> avoid compilation error by commit beba3693f7243e68bbe31fe3794da91068eeea5b.
> 

I suggest pasting in Olaf's exact error message here.

To avoid extra round trip, I propose updating the commit message as
followed:

    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

If you agree with this I will handle the updating while doing my next
sweep.

Wei.
diff mbox

Patch

diff --git a/tools/misc/xen-livepatch.c b/tools/misc/xen-livepatch.c
index 3162489..62c072e 100644
--- a/tools/misc/xen-livepatch.c
+++ b/tools/misc/xen-livepatch.c
@@ -412,7 +412,7 @@  struct {
 
 int main(int argc, char *argv[])
 {
-    int i, j, ret;
+    int i, j = 0, ret;
 
     if ( argc  <= 1 )
     {