The CPU indexes for NUMA nodes make sense only up to max_cpus, and CPU
indexes > max_cpus are ignored. Reject configuration which uses invalid
CPU indexes.

Signed-off-by: Eduardo Habkost <ehabk...@redhat.com>
---
 numa.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/numa.c b/numa.c
index 0d15375..f768434 100644
--- a/numa.c
+++ b/numa.c
@@ -76,9 +76,10 @@ 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);
+        if (cpus->value > max_cpus) {
+            error_setg(errp,
+                       "CPU number %" PRIu16 " is bigger than maxcpus (%d)",
+                       cpus->value, max_cpus);
             return;
         }
         bitmap_set(numa_info[nodenr].node_cpu, cpus->value, 1);
-- 
2.1.0


Reply via email to