diff options
author | Eduardo Habkost <ehabkost@redhat.com> | 2015-02-09 17:28:52 -0200 |
---|---|---|
committer | Eduardo Habkost <ehabkost@redhat.com> | 2015-03-19 16:01:22 -0300 |
commit | 8979c945c1a7ffd20edbd5da2513c04baccfd7de (patch) | |
tree | b78b1f1e65e60c0f73565a625d65f931294abdb4 | |
parent | ed26b92290768818371fbfd4317988eab6009ad5 (diff) |
numa: Reject CPU indexes > max_cpus
CPU index is always less than max_cpus, as documented at sysemu.h:
> The following shall be true for all CPUs:
> cpu->cpu_index < max_cpus <= MAX_CPUMASK_BITS
Reject configuration which uses invalid CPU indexes.
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
-rw-r--r-- | numa.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -76,9 +76,11 @@ static void numa_node_parse(NumaNodeOptions *node, QemuOpts *opts, Error **errp) } for (cpus = node->cpus; cpus; cpus = cpus->next) { - if (cpus->value >= MAX_CPUMASK_BITS) { - error_setg(errp, "CPU number %" PRIu16 " is bigger than %d", - cpus->value, MAX_CPUMASK_BITS - 1); + if (cpus->value >= max_cpus) { + error_setg(errp, + "CPU index (%" PRIu16 ")" + " should be smaller than maxcpus (%d)", + cpus->value, max_cpus); return; } bitmap_set(numa_info[nodenr].node_cpu, cpus->value, 1); |