Message ID | 1403818400-13671-3-git-send-email-ehabkost@redhat.com |
---|---|
State | New |
Headers | show |
On Thu, Jun 26, 2014 at 06:33:19PM -0300, Eduardo Habkost wrote: > The same nodeid shouldn't appear multiple times in the command-line. > > In addition to detecting command-line mistakes, this will fix a bug > where nb_numa_nodes may become larger than MAX_NODES (and cause > out-of-bounds access on the numa_info array). > > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Hu Tao <hutao@cn.fujitsu.com> This patch makes me remembering the same problem for cpus, like -numa ..cpus=1,.. -numa ..cpus=1,.., in the case one node has cpu, the other doesn't. Maybe we should eject it too. > --- > numa.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/numa.c b/numa.c > index 3de9116..e93407a 100644 > --- a/numa.c > +++ b/numa.c > @@ -62,6 +62,11 @@ static void numa_node_parse(NumaNodeOptions *node, QemuOpts *opts, Error **errp) > return; > } > > + if (numa_info[nodenr].present) { > + error_setg(errp, "Duplicate NUMA nodeid: %" PRIu16, nodenr); > + return; > + } > + > for (cpus = node->cpus; cpus; cpus = cpus->next) { > if (cpus->value > MAX_CPUMASK_BITS) { > error_setg(errp, "CPU number %" PRIu16 " is bigger than %d", > -- > 1.9.3
diff --git a/numa.c b/numa.c index 3de9116..e93407a 100644 --- a/numa.c +++ b/numa.c @@ -62,6 +62,11 @@ static void numa_node_parse(NumaNodeOptions *node, QemuOpts *opts, Error **errp) return; } + if (numa_info[nodenr].present) { + error_setg(errp, "Duplicate NUMA nodeid: %" PRIu16, nodenr); + return; + } + for (cpus = node->cpus; cpus; cpus = cpus->next) { if (cpus->value > MAX_CPUMASK_BITS) { error_setg(errp, "CPU number %" PRIu16 " is bigger than %d",
The same nodeid shouldn't appear multiple times in the command-line. In addition to detecting command-line mistakes, this will fix a bug where nb_numa_nodes may become larger than MAX_NODES (and cause out-of-bounds access on the numa_info array). Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> --- numa.c | 5 +++++ 1 file changed, 5 insertions(+)