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

Re: [Xen-devel] [PATCH] tools/xl: refuse to set number of vcpus to 0 via xl vcpu-set



>>> On 03.09.18 at 13:59, <jgross@xxxxxxxx> wrote:
> --- a/tools/xl/xl_vcpu.c
> +++ b/tools/xl/xl_vcpu.c
> @@ -341,6 +341,10 @@ static int vcpuset(uint32_t domid, const char* nr_vcpus, 
> int check_host)
>          fprintf(stderr, "Error: Invalid argument.\n");
>          return 1;
>      }
> +    if (nr_vcpus == 0) {
> +        fprintf(stderr, "Error: Setting number of vcpus to 0 isn't 
> allowed.\n");
> +        return 1;
> +    }

This message is liable to be confusing when the string passed in
represents a non-zero number which, when converted to
unsigned int, yields zero. I think more thorough input checking is
needed here. main_vcpupin(), for example, deliberately uses a
type wider than seemingly necessary, to avoid such an issue.

I also wonder whether rejecting zero here is really the job of the
frontend, rather than libxl.

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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