Commit 1945b9d8 authored by Eduardo Habkost's avatar Eduardo Habkost Committed by Michael S. Tsirkin

numa: Reject duplicate node IDs

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: default avatarEduardo Habkost <>
Reviewed-by: default avatarMichael S. Tsirkin <>
Signed-off-by: default avatarMichael S. Tsirkin <>
Reviewed-by: default avatarHu Tao <>
Reviewed-by: default avatarEric Blake <>
parent 1af878e0
......@@ -62,6 +62,11 @@ static void numa_node_parse(NumaNodeOptions *node, QemuOpts *opts, Error **errp)
if (numa_info[nodenr].present) {
error_setg(errp, "Duplicate NUMA nodeid: %" PRIu16, nodenr);
for (cpus = node->cpus; cpus; cpus = cpus->next) {
if (cpus->value > MAX_CPUMASK_BITS) {
error_setg(errp, "CPU number %" PRIu16 " is bigger than %d",
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment