xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/1] tools/livepatch: cleanup unnecessary "j = ARRAY_SIZE(action_options); "
@ 2016-06-15  0:41 Dongli Zhang
  2016-06-15  8:52 ` Wei Liu
  0 siblings, 1 reply; 4+ messages in thread
From: Dongli Zhang @ 2016-06-15  0:41 UTC (permalink / raw)
  To: xen-devel, konrad.wilk, ross.lagerwall, ian.jackson, wei.liu2

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.

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

diff --git a/tools/misc/xen-livepatch.c b/tools/misc/xen-livepatch.c
index 28f339a..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 )
     {
@@ -435,8 +435,7 @@ int main(int argc, char *argv[])
                    "'xen-livepatch help'\n", argv[1]);
             return 1;
         }
-    } else
-        j = ARRAY_SIZE(action_options);
+    }
 
     xch = xc_interface_open(0,0,0);
     if ( !xch )
-- 
1.9.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/1] tools/livepatch: cleanup unnecessary "j = ARRAY_SIZE(action_options); "
  2016-06-15  0:41 [PATCH v2 1/1] tools/livepatch: cleanup unnecessary "j = ARRAY_SIZE(action_options); " Dongli Zhang
@ 2016-06-15  8:52 ` Wei Liu
  2016-06-15  9:04   ` Olaf Hering
  0 siblings, 1 reply; 4+ messages in thread
From: Wei Liu @ 2016-06-15  8:52 UTC (permalink / raw)
  To: Dongli Zhang; +Cc: ross.lagerwall, ian.jackson, wei.liu2, xen-devel

On Wed, Jun 15, 2016 at 08:41:18AM +0800, 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.
> 
> Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>

Your original patch has been committed. That's why Olaf is seeing
compilation error. It is currently in staging branch. Osstest (the CI
system) will test it (well, in fact there is not yet a test case). If
the test succeeds, all the patches tested will be pushed to master
branch.

To fix the breakage, please check out staging branch and write a patch
to fix it. And maybe the commit message should say something like
"initialise j to 0 to make some versions of gcc happy".

If you have further question, feel free to ask. :-)

Wei.

> ---
>  tools/misc/xen-livepatch.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/misc/xen-livepatch.c b/tools/misc/xen-livepatch.c
> index 28f339a..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 )
>      {
> @@ -435,8 +435,7 @@ int main(int argc, char *argv[])
>                     "'xen-livepatch help'\n", argv[1]);
>              return 1;
>          }
> -    } else
> -        j = ARRAY_SIZE(action_options);
> +    }
>  
>      xch = xc_interface_open(0,0,0);
>      if ( !xch )
> -- 
> 1.9.1
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/1] tools/livepatch: cleanup unnecessary "j = ARRAY_SIZE(action_options); "
  2016-06-15  8:52 ` Wei Liu
@ 2016-06-15  9:04   ` Olaf Hering
  2016-06-15  9:10     ` Wei Liu
  0 siblings, 1 reply; 4+ messages in thread
From: Olaf Hering @ 2016-06-15  9:04 UTC (permalink / raw)
  To: Wei Liu; +Cc: Dongli Zhang, xen-devel, ian.jackson, ross.lagerwall

On Wed, Jun 15, Wei Liu wrote:

> To fix the breakage, please check out staging branch and write a patch
> to fix it. And maybe the commit message should say something like
> "initialise j to 0 to make some versions of gcc happy".

Not "some", but rather "at least gcc4.5/4.3" or similar.
There are already enough "some"s out there, where in the end noone knows
what the given workaround is all about.

Olaf

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/1] tools/livepatch: cleanup unnecessary "j = ARRAY_SIZE(action_options); "
  2016-06-15  9:04   ` Olaf Hering
@ 2016-06-15  9:10     ` Wei Liu
  0 siblings, 0 replies; 4+ messages in thread
From: Wei Liu @ 2016-06-15  9:10 UTC (permalink / raw)
  To: Olaf Hering; +Cc: Dongli Zhang, xen-devel, Wei Liu, ian.jackson, ross.lagerwall

On Wed, Jun 15, 2016 at 11:04:40AM +0200, Olaf Hering wrote:
> On Wed, Jun 15, Wei Liu wrote:
> 
> > To fix the breakage, please check out staging branch and write a patch
> > to fix it. And maybe the commit message should say something like
> > "initialise j to 0 to make some versions of gcc happy".
> 
> Not "some", but rather "at least gcc4.5/4.3" or similar.
> There are already enough "some"s out there, where in the end noone knows
> what the given workaround is all about.
> 

Fine by me of course. I didn't have a list of known offenders so I
couldn't suggest concrete version numbers.

Wei.

> Olaf

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-06-15  9:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-15  0:41 [PATCH v2 1/1] tools/livepatch: cleanup unnecessary "j = ARRAY_SIZE(action_options); " Dongli Zhang
2016-06-15  8:52 ` Wei Liu
2016-06-15  9:04   ` Olaf Hering
2016-06-15  9:10     ` Wei Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).