diff mbox

[1/1] tools/livepatch: cleanup unnecessary "j = ARRAY_SIZE(action_options); "

Message ID 20160614200745.GA7548@char.us.oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Konrad Rzeszutek Wilk June 14, 2016, 8:07 p.m. UTC
On Tue, Jun 14, 2016 at 09:22:45PM +0200, Olaf Hering wrote:
> On Fri, Jun 10, Dongli Zhang wrote:
> 
> > Local variable "j" would be used only when "i == ARRAY_SIZE(main_options)"
> > is true. Thus, it is not necessary to update "j" when "i ==
> > ARRAY_SIZE(main_options)" is false.
> 
> This breaks the build with gcc45:
> 
> [  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
> 
> Olaf

?
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 )
     {