* [PATCH v2] xl: initialise rc before using it in vcpuset
@ 2015-11-04 11:32 Wei Liu
2015-11-04 11:38 ` Dario Faggioli
2015-11-04 11:39 ` Ian Campbell
0 siblings, 2 replies; 5+ messages in thread
From: Wei Liu @ 2015-11-04 11:32 UTC (permalink / raw)
To: Xen-devel
Cc: Wei Liu, Ian Campbell, Andrew Cooper, Dario Faggioli, Ian Jackson,
Harmandeep Kaur
In 5b725e56 (xl: improve return and exit codes of vcpu related
functions), the return value of libxl_cpu_bitmap_alloc was not stored in
rc anymore. Yet the subsequent fprintf still used that.
Reinstate the original implementation, that is, to store return value of
libxl_cpu_bitmap_alloc in rc before using rc.
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Dario Faggioli <dario.faggioli@citrix.com>
Cc: Harmandeep Kaur <write.harmandeep@gmail.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
v2: print rc.
---
tools/libxl/xl_cmdimpl.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 2756d2f..9b6b42c 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -5473,7 +5473,8 @@ static int vcpuset(uint32_t domid, const char* nr_vcpus, int check_host)
if (rc)
return 1;
}
- if (libxl_cpu_bitmap_alloc(ctx, &cpumap, max_vcpus)) {
+ rc = libxl_cpu_bitmap_alloc(ctx, &cpumap, max_vcpus);
+ if (rc) {
fprintf(stderr, "libxl_cpu_bitmap_alloc failed, rc: %d\n", rc);
return 1;
}
--
2.1.4
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH v2] xl: initialise rc before using it in vcpuset
2015-11-04 11:32 [PATCH v2] xl: initialise rc before using it in vcpuset Wei Liu
@ 2015-11-04 11:38 ` Dario Faggioli
2015-11-04 11:47 ` Ian Campbell
2015-11-04 11:39 ` Ian Campbell
1 sibling, 1 reply; 5+ messages in thread
From: Dario Faggioli @ 2015-11-04 11:38 UTC (permalink / raw)
To: Wei Liu, Xen-devel
Cc: Andrew Cooper, Ian Jackson, Ian Campbell, Harmandeep Kaur
[-- Attachment #1.1: Type: text/plain, Size: 1045 bytes --]
On Wed, 2015-11-04 at 11:32 +0000, Wei Liu wrote:
> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> index 2756d2f..9b6b42c 100644
> --- a/tools/libxl/xl_cmdimpl.c
> +++ b/tools/libxl/xl_cmdimpl.c
> @@ -5473,7 +5473,8 @@ static int vcpuset(uint32_t domid, const char*
> nr_vcpus, int check_host)
> if (rc)
> return 1;
> }
> - if (libxl_cpu_bitmap_alloc(ctx, &cpumap, max_vcpus)) {
> + rc = libxl_cpu_bitmap_alloc(ctx, &cpumap, max_vcpus);
> + if (rc) {
> fprintf(stderr, "libxl_cpu_bitmap_alloc failed, rc: %d\n",
> rc);
> return 1;
> }
>
Don't we also need to initialise rc to 0? It seems to me that it may be
used uninitialised also inside of if(check_host)...
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: 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] 5+ messages in thread* Re: [PATCH v2] xl: initialise rc before using it in vcpuset
2015-11-04 11:38 ` Dario Faggioli
@ 2015-11-04 11:47 ` Ian Campbell
2015-11-04 11:50 ` Dario Faggioli
0 siblings, 1 reply; 5+ messages in thread
From: Ian Campbell @ 2015-11-04 11:47 UTC (permalink / raw)
To: Dario Faggioli, Wei Liu, Xen-devel
Cc: Andrew Cooper, Ian Jackson, Harmandeep Kaur
On Wed, 2015-11-04 at 12:38 +0100, Dario Faggioli wrote:
> On Wed, 2015-11-04 at 11:32 +0000, Wei Liu wrote:
>
> > diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> > index 2756d2f..9b6b42c 100644
> > --- a/tools/libxl/xl_cmdimpl.c
> > +++ b/tools/libxl/xl_cmdimpl.c
> > @@ -5473,7 +5473,8 @@ static int vcpuset(uint32_t domid, const char*
> > nr_vcpus, int check_host)
> > if (rc)
> > return 1;
> > }
> > - if (libxl_cpu_bitmap_alloc(ctx, &cpumap, max_vcpus)) {
> > + rc = libxl_cpu_bitmap_alloc(ctx, &cpumap, max_vcpus);
> > + if (rc) {
> > fprintf(stderr, "libxl_cpu_bitmap_alloc failed, rc: %d\n",
> > rc);
> > return 1;
> > }
> >
> Don't we also need to initialise rc to 0? It seems to me that it may be
> used uninitialised also inside of if(check_host)...
Looks like it, a separate issue though.
Don't initialise rc to 0, add a suitable else though.
>
> Regards,
> Dario
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v2] xl: initialise rc before using it in vcpuset
2015-11-04 11:47 ` Ian Campbell
@ 2015-11-04 11:50 ` Dario Faggioli
0 siblings, 0 replies; 5+ messages in thread
From: Dario Faggioli @ 2015-11-04 11:50 UTC (permalink / raw)
To: Ian Campbell, Wei Liu, Xen-devel
Cc: Andrew Cooper, Ian Jackson, Harmandeep Kaur
[-- Attachment #1.1: Type: text/plain, Size: 1527 bytes --]
On Wed, 2015-11-04 at 11:47 +0000, Ian Campbell wrote:
> On Wed, 2015-11-04 at 12:38 +0100, Dario Faggioli wrote:
> > On Wed, 2015-11-04 at 11:32 +0000, Wei Liu wrote:
> >
> > > diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> > > index 2756d2f..9b6b42c 100644
> > > --- a/tools/libxl/xl_cmdimpl.c
> > > +++ b/tools/libxl/xl_cmdimpl.c
> > > @@ -5473,7 +5473,8 @@ static int vcpuset(uint32_t domid, const
> > > char*
> > > nr_vcpus, int check_host)
> > > if (rc)
> > > return 1;
> > > }
> > > - if (libxl_cpu_bitmap_alloc(ctx, &cpumap, max_vcpus)) {
> > > + rc = libxl_cpu_bitmap_alloc(ctx, &cpumap, max_vcpus);
> > > + if (rc) {
> > > fprintf(stderr, "libxl_cpu_bitmap_alloc failed, rc:
> > > %d\n",
> > > rc);
> > > return 1;
> > > }
> > >
> > Don't we also need to initialise rc to 0? It seems to me that it
> > may be
> > used uninitialised also inside of if(check_host)...
>
> Looks like it, a separate issue though.
>
The compiler is not spotting it again, though (just as a side note).
> Don't initialise rc to 0, add a suitable else though.
>
Yeah, sure, I figured that out after having sent the mail. I'll send a
patch.
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: 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] 5+ messages in thread
* Re: [PATCH v2] xl: initialise rc before using it in vcpuset
2015-11-04 11:32 [PATCH v2] xl: initialise rc before using it in vcpuset Wei Liu
2015-11-04 11:38 ` Dario Faggioli
@ 2015-11-04 11:39 ` Ian Campbell
1 sibling, 0 replies; 5+ messages in thread
From: Ian Campbell @ 2015-11-04 11:39 UTC (permalink / raw)
To: Wei Liu, Xen-devel
Cc: Andrew Cooper, Dario Faggioli, Ian Jackson, Harmandeep Kaur
On Wed, 2015-11-04 at 11:32 +0000, Wei Liu wrote:
> In 5b725e56 (xl: improve return and exit codes of vcpu related
> functions), the return value of libxl_cpu_bitmap_alloc was not stored in
> rc anymore. Yet the subsequent fprintf still used that.
>
> Reinstate the original implementation, that is, to store return value of
> libxl_cpu_bitmap_alloc in rc before using rc.
>
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked + applied.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-11-04 11:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-04 11:32 [PATCH v2] xl: initialise rc before using it in vcpuset Wei Liu
2015-11-04 11:38 ` Dario Faggioli
2015-11-04 11:47 ` Ian Campbell
2015-11-04 11:50 ` Dario Faggioli
2015-11-04 11:39 ` Ian Campbell
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.