qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [libvirt] [PATCH 03/10] vl.c: Isolate code specific to


From: Eric Blake
Subject: Re: [Qemu-devel] [libvirt] [PATCH 03/10] vl.c: Isolate code specific to "-numa node" option type
Date: Fri, 11 Jan 2013 14:06:05 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0

On 01/11/2013 11:15 AM, Eduardo Habkost wrote:
> Extract the code that's specific for the "node" -numa option type (the
> only one, today) to a separate function.
> 
> The extracted code will eventually become a function specific for a
> "numa-node" config section, independent from the numa_add() code.

> +    if (get_param_value(option, 128, "nodeid", optarg) == 0) {
> +        nodenr = nb_numa_nodes;
> +    } else {
> +        nodenr = strtoull(option, NULL, 10);
>      }

strtoull() needs additional error checking after the fact, to make sure
I didn't pass an empty string, trailing garbage, or so many digits I
triggered overflow.


> +    if (get_param_value(option, 128, "cpus", optarg) != 0) {
> +        value = strtoull(option, &endptr, 10);
> +        if (*endptr == '-') {
> +            endvalue = strtoull(endptr+1, &endptr, 10);
>          } else {
> -            nodenr = strtoull(option, NULL, 10);
> +            endvalue = value;
>          }

More uses of strtoull() that aren't guarding against all possible errors.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]