xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libxl: 'valid_devs' may be used uninitialized
@ 2015-05-15 17:06 Charles Arnold
  2015-05-15 17:39 ` Dario Faggioli
  0 siblings, 1 reply; 3+ messages in thread
From: Charles Arnold @ 2015-05-15 17:06 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Campbell

Using gcc 4.8 to compile with -Werror.

xl_cmdimpl.c:5493:8: error: 'valid_devs' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      if (valid_devs == 0)
         ^
xl_cmdimpl.c:5455:9: note: 'valid_devs' was declared here
      int valid_devs;

Signed-off-by: Charles Arnold <carnold@suse.com>

diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 373aa37..6d60ce4 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -5423,7 +5423,7 @@ static void output_topologyinfo(void)
     libxl_cputopology *cpuinfo;
     int i, nr;
     libxl_pcitopology *pciinfo;
-    int valid_devs;
+    int valid_devs = 0;
 
 
     cpuinfo = libxl_get_cpu_topology(ctx, &nr);

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

* Re: [PATCH] libxl: 'valid_devs' may be used uninitialized
  2015-05-15 17:06 [PATCH] libxl: 'valid_devs' may be used uninitialized Charles Arnold
@ 2015-05-15 17:39 ` Dario Faggioli
  2015-05-21 14:52   ` Ian Campbell
  0 siblings, 1 reply; 3+ messages in thread
From: Dario Faggioli @ 2015-05-15 17:39 UTC (permalink / raw)
  To: Charles Arnold; +Cc: Ian Campbell, xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 1018 bytes --]

On Fri, 2015-05-15 at 11:06 -0600, Charles Arnold wrote:
> Using gcc 4.8 to compile with -Werror.
> 
> xl_cmdimpl.c:5493:8: error: 'valid_devs' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>       if (valid_devs == 0)
>          ^
> xl_cmdimpl.c:5455:9: note: 'valid_devs' was declared here
>       int valid_devs;
> 
> Signed-off-by: Charles Arnold <carnold@suse.com>
> 
Reviewed-by: Dario Faggioli <dario.faggioli@citrix.com>

Although, while there...

> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> index 373aa37..6d60ce4 100644
> --- a/tools/libxl/xl_cmdimpl.c
> +++ b/tools/libxl/xl_cmdimpl.c
> @@ -5423,7 +5423,7 @@ static void output_topologyinfo(void)
>      libxl_cputopology *cpuinfo;
>      int i, nr;
>      libxl_pcitopology *pciinfo;
> -    int valid_devs;
> +    int valid_devs = 0;
>  
>
>      cpuinfo = libxl_get_cpu_topology(ctx, &nr);
> 
...You could kill one of the two blank line (one is enough).

Regards,
Dario

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

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

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

* Re: [PATCH] libxl: 'valid_devs' may be used uninitialized
  2015-05-15 17:39 ` Dario Faggioli
@ 2015-05-21 14:52   ` Ian Campbell
  0 siblings, 0 replies; 3+ messages in thread
From: Ian Campbell @ 2015-05-21 14:52 UTC (permalink / raw)
  To: Dario Faggioli; +Cc: Charles Arnold, xen-devel

On Fri, 2015-05-15 at 19:39 +0200, Dario Faggioli wrote:
> On Fri, 2015-05-15 at 11:06 -0600, Charles Arnold wrote:
> > Using gcc 4.8 to compile with -Werror.
> > 
> > xl_cmdimpl.c:5493:8: error: 'valid_devs' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> >       if (valid_devs == 0)
> >          ^
> > xl_cmdimpl.c:5455:9: note: 'valid_devs' was declared here
> >       int valid_devs;
> > 
> > Signed-off-by: Charles Arnold <carnold@suse.com>
> > 
> Reviewed-by: Dario Faggioli <dario.faggioli@citrix.com>

Acked + applied, thanks

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

end of thread, other threads:[~2015-05-21 14:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-15 17:06 [PATCH] libxl: 'valid_devs' may be used uninitialized Charles Arnold
2015-05-15 17:39 ` Dario Faggioli
2015-05-21 14:52   ` Ian Campbell

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).