]> Git Repo - qemu.git/commitdiff
vl.c: Check for NUMA node limit inside numa_add()
authorEduardo Habkost <[email protected]>
Mon, 4 Feb 2013 18:27:48 +0000 (16:27 -0200)
committerAnthony Liguori <[email protected]>
Mon, 4 Feb 2013 20:38:33 +0000 (14:38 -0600)
Instead of checking the limit before calling numa_add(), check the limit
only when we already know we're going to add a new node.

Signed-off-by: Eduardo Habkost <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
vl.c

diff --git a/vl.c b/vl.c
index 586aa9a70a67e8c419e37ebf5240491dc945aebb..89de00398f22e3da745f28ab35f8b4492d90507b 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -1258,6 +1258,12 @@ static void numa_add(const char *optarg)
         optarg++;
     }
     if (!strcmp(option, "node")) {
+
+        if (nb_numa_nodes >= MAX_NODES) {
+            fprintf(stderr, "qemu: too many NUMA nodes\n");
+            exit(1);
+        }
+
         if (get_param_value(option, 128, "nodeid", optarg) == 0) {
             nodenr = nb_numa_nodes;
         } else {
@@ -3003,10 +3009,6 @@ int main(int argc, char **argv, char **envp)
                 }
                 break;
             case QEMU_OPTION_numa:
-                if (nb_numa_nodes >= MAX_NODES) {
-                    fprintf(stderr, "qemu: too many NUMA nodes\n");
-                    exit(1);
-                }
                 numa_add(optarg);
                 break;
             case QEMU_OPTION_display:
This page took 0.031855 seconds and 4 git commands to generate.