[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 8/8] vl.c: validate -numa "cpus" parameter prope
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 8/8] vl.c: validate -numa "cpus" parameter properly |
Date: |
Wed, 16 Jan 2013 10:30:25 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 |
On 01/16/2013 08:24 AM, Eduardo Habkost wrote:
> - Accept empty strings without aborting
> - Use parse_uint*() to parse numbers
> - Abort if anything except '-' or end-of-string is found after the first
> number.
> - Check for endvalue < value
>
> Also change the MAX_CPUMASK_BITS warning message from "A max of %d CPUs
> are supported in a guest" to "qemu: NUMA: A max of %d VCPUs are
> supported".
>
> Signed-off-by: Eduardo Habkost <address@hidden>
> ---
> Cc: Eric Blake <address@hidden>
> ---
> vl.c | 32 +++++++++++++++++++++++++++-----
> 1 file changed, 27 insertions(+), 5 deletions(-)
>
>
> - value = strtoull(cpus, &endptr, 10);
> + /* Empty CPU range strings will be considered valid, they will simply
> + * not set any bit in the CPU bitmap.
> + */
> + if (!*cpus) {
> + return;
Does the code behave correctly when there are no bits in the CPU bitmap,
or do you require that at least one bit be set?
> + }
> +
> + if (parse_uint(cpus, &value, &endptr) < 0) {
> + goto error;
Again, another case of accepting octal where you used to only accept
binary; if the change of interpretation of 010 is intentional, it would
be worth documenting in the commit message. Otherwise, it might be
worth refactoring 1/8 to add a 'base' parameter to parse_uint[_full] to
allow the caller to control whether they want base 0 or base 10.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
[Qemu-devel] [PATCH 2/8] vl.c: Fix off-by-one bug when handling "-numa node" argument, Eduardo Habkost, 2013/01/16
[Qemu-devel] [PATCH 3/8] vl.c: Abort on unknown -numa option type, Eduardo Habkost, 2013/01/16
[Qemu-devel] [PATCH 8/8] vl.c: validate -numa "cpus" parameter properly, Eduardo Habkost, 2013/01/16
- Re: [Qemu-devel] [PATCH 8/8] vl.c: validate -numa "cpus" parameter properly,
Eric Blake <=
[Qemu-devel] [PATCH 1/8] cutils: unsigned int parsing functions, Eduardo Habkost, 2013/01/16
[Qemu-devel] [PATCH 5/8] vl.c: numa_add(): Validate nodeid before using it, Eduardo Habkost, 2013/01/16
[Qemu-devel] [PATCH 4/8] vl.c: Check for NUMA node limit inside numa_add(), Eduardo Habkost, 2013/01/16