qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 6/8] vl.c: Use parse_uint_full() for NUMA nodeid


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 6/8] vl.c: Use parse_uint_full() for NUMA nodeid
Date: Wed, 16 Jan 2013 10:25:31 -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:
> This should catch many kinds of errors that the current code wasn't
> checking for:
> 
>  - Values that can't be parsed as a number
>  - Negative values
>  - Overflow
>  - Empty string
> 
> Signed-off-by: Eduardo Habkost <address@hidden>
> ---
> Cc: Eric Blake <address@hidden>
> ---
>  vl.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 

> +++ b/vl.c
> @@ -1264,11 +1264,14 @@ static void numa_add(const char *optarg)
>          if (get_param_value(option, 128, "nodeid", optarg) == 0) {
>              nodenr = nb_numa_nodes;
>          } else {
> -            nodenr = strtoull(option, NULL, 10);
> +            if (parse_uint_full(option, &nodenr) < 0) {

This allows a user to pass octal or hex numbers, where previously it was
forced to be decimal.  That means 'nodeid=010' is now '8' instead of
'10'; is that intentional?

>  
>          if (nodenr >= MAX_NODES) {
> -            fprintf(stderr, "qemu: invalid NUMA nodeid: %d\n", nodenr);
> +            fprintf(stderr, "qemu: invalid NUMA nodeid: %llu\n", nodenr);

Already mentions that this part belongs in 5/8.

-- 
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]