[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] xl: convert vcpuid to signed in main_vcpupin()



On Wed, 2014-08-20 at 17:36 +0200, Dario Faggioli wrote:
> No functional changes, it just looks more correct, considering
> that at some point in the function we assign -1 to it (and
> at some other later point we check for it to be -1),

I think that's more than just "looks more correct", it's just wrong to
compare an unsigned to -1, or to assign it.

And there may well be a functional change since gcc is no longer allowed
to assume that the number is +ve and therefore cannot discard some of
these checks any more. We are probably just lucky that gcc isn't doing
so already (and unlucky that it isn't generating a warning...)

>  to
> signify 'all vcpus'.
> 
> While at it, fix a coding style nit and improve error reporting.
> 
> Signed-off-by: Dario Faggioli <dario.faggioli@xxxxxxxxxx>
> ---
>  tools/libxl/xl_cmdimpl.c |   14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> index f1c136a..a29a579 100644
> --- a/tools/libxl/xl_cmdimpl.c
> +++ b/tools/libxl/xl_cmdimpl.c
> @@ -4601,8 +4601,9 @@ int main_vcpupin(int argc, char **argv)
>      libxl_vcpuinfo *vcpuinfo;
>      libxl_bitmap cpumap_hard, cpumap_soft;;
>      libxl_bitmap *soft = &cpumap_soft, *hard = &cpumap_hard;
> -    uint32_t vcpuid, domid;
>      const char *vcpu, *hard_str, *soft_str;
> +    uint32_t domid;
> +    long vcpuid;

I think an int would be sufficiently large for this.

Ian.


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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.