qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PULL 11/37] numa: Reject duplicate node IDs


From: Michael S. Tsirkin
Subject: [Qemu-devel] [PULL 11/37] numa: Reject duplicate node IDs
Date: Sun, 29 Jun 2014 19:58:40 +0300

From: Eduardo Habkost <address@hidden>

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 <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
Reviewed-by: Hu Tao <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
 numa.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/numa.c b/numa.c
index db10f95..c254127 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",
-- 
MST




reply via email to

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