qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2] Fixes related to processing of qemu's -numa


From: Eduardo Habkost
Subject: Re: [Qemu-devel] [PATCH v2] Fixes related to processing of qemu's -numa option
Date: Mon, 25 Jun 2012 17:00:31 -0300
User-agent: Mutt/1.5.21 (2010-09-15)

Just found another issue:

On Wed, Jun 20, 2012 at 05:33:29PM -0300, Eduardo Habkost wrote:
[...]
> > @@ -970,27 +974,24 @@ static void numa_add(const char *optarg)
> >              }
> >              node_mem[nodenr] = sval;
> >          }
> > -        if (get_param_value(option, 128, "cpus", optarg) == 0) {
> > -            node_cpumask[nodenr] = 0;
> > -        } else {
> > +        if (get_param_value(option, 128, "cpus", optarg) != 0) {
> >              value = strtoull(option, &endptr, 10);
> > -            if (value >= 64) {
> > -                value = 63;
> > -                fprintf(stderr, "only 64 CPUs in NUMA mode supported.\n");
> > +            if (*endptr == '-') {
> > +                endvalue = strtoull(endptr+1, &endptr, 10);
> >              } else {
> > -                if (*endptr == '-') {
> > -                    endvalue = strtoull(endptr+1, &endptr, 10);
> > -                    if (endvalue >= 63) {
> > -                        endvalue = 62;
> > -                        fprintf(stderr,
> > -                            "only 63 CPUs in NUMA mode supported.\n");
> > -                    }
> > -                    value = (2ULL << endvalue) - (1ULL << value);
> > -                } else {
> > -                    value = 1ULL << value;
> > -                }
> > +                endvalue = value;
> > +            }
> > +
> > +            if (endvalue >= max_cpus) {
> > +                endvalue = max_cpus - 1;
> > +                fprintf(stderr,
> > +                    "A max of %d CPUs are supported in a guest on this 
> > host\n",
> > +                                           max_cpus);
> > +            }

This makes the following command segfault:

$ qemu-system-x86_64 -numa 'node,cpus=1-3' -smp 100

max_cpus may be not initialized yet at the call to numa_add(), as you
are still parsing the command-line options.

-- 
Eduardo



reply via email to

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