All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] libxl: initialise nr_dom_vcpus to fix 4a6070ea9
@ 2016-10-24 10:11 Wei Liu
  2016-10-24 10:22 ` Dario Faggioli
  2016-10-24 10:36 ` Ian Jackson
  0 siblings, 2 replies; 3+ messages in thread
From: Wei Liu @ 2016-10-24 10:11 UTC (permalink / raw)
  To: Xen-devel; +Cc: Juergen Gross, Ian Jackson, Dario Faggioli, Wei Liu

Clang complains nr_dom_vcpus may be used uninitialised after
4a6070ea9.

The real issue is vinfo can be NULL and nr_dom_vcpus remains
uninitialised if previous call fails.

Initialise nr_dom_vcpus to 0 at the beginning of the loop to fix the
issue.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Dario Faggioli <dario.faggioli@citrix.com>
Cc: Juergen Gross <jgross@suse.com>
---
 tools/libxl/libxl_numa.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/libxl/libxl_numa.c b/tools/libxl/libxl_numa.c
index fd64c22..a8a75f8 100644
--- a/tools/libxl/libxl_numa.c
+++ b/tools/libxl/libxl_numa.c
@@ -206,8 +206,9 @@ static int nr_vcpus_on_nodes(libxl__gc *gc, libxl_cputopology *tinfo,
 
     for (i = 0; i < nr_doms; i++) {
         libxl_vcpuinfo *vinfo = NULL;
+        int nr_dom_vcpus = 0;
         libxl_cpupoolinfo cpupool_info;
-        int cpupool, nr_dom_vcpus;
+        int cpupool;
 
         libxl_cpupoolinfo_init(&cpupool_info);
 
-- 
2.1.4


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

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

* Re: [PATCH v2] libxl: initialise nr_dom_vcpus to fix 4a6070ea9
  2016-10-24 10:11 [PATCH v2] libxl: initialise nr_dom_vcpus to fix 4a6070ea9 Wei Liu
@ 2016-10-24 10:22 ` Dario Faggioli
  2016-10-24 10:36 ` Ian Jackson
  1 sibling, 0 replies; 3+ messages in thread
From: Dario Faggioli @ 2016-10-24 10:22 UTC (permalink / raw)
  To: Wei Liu, Xen-devel; +Cc: Juergen Gross, Ian Jackson


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

On Mon, 2016-10-24 at 11:11 +0100, Wei Liu wrote:
> Clang complains nr_dom_vcpus may be used uninitialised after
> 4a6070ea9.
> 
> The real issue is vinfo can be NULL and nr_dom_vcpus remains
> uninitialised if previous call fails.
> 
> Initialise nr_dom_vcpus to 0 at the beginning of the loop to fix the
> issue.
> 
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
>
Reviewed-by: Dario Faggioli <dario.faggioli@citrix.com>

Thanks and Regards,
Dario
-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

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

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

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

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

* Re: [PATCH v2] libxl: initialise nr_dom_vcpus to fix 4a6070ea9
  2016-10-24 10:11 [PATCH v2] libxl: initialise nr_dom_vcpus to fix 4a6070ea9 Wei Liu
  2016-10-24 10:22 ` Dario Faggioli
@ 2016-10-24 10:36 ` Ian Jackson
  1 sibling, 0 replies; 3+ messages in thread
From: Ian Jackson @ 2016-10-24 10:36 UTC (permalink / raw)
  To: Wei Liu; +Cc: Juergen Gross, Xen-devel, Dario Faggioli

Wei Liu writes ("[PATCH v2] libxl: initialise nr_dom_vcpus to fix 4a6070ea9"):
> Clang complains nr_dom_vcpus may be used uninitialised after
> 4a6070ea9.
> 
> The real issue is vinfo can be NULL and nr_dom_vcpus remains
> uninitialised if previous call fails.
> 
> Initialise nr_dom_vcpus to 0 at the beginning of the loop to fix the
> issue.

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

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

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

end of thread, other threads:[~2016-10-24 10:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-24 10:11 [PATCH v2] libxl: initialise nr_dom_vcpus to fix 4a6070ea9 Wei Liu
2016-10-24 10:22 ` Dario Faggioli
2016-10-24 10:36 ` Ian Jackson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.