提交 ca4c6d36 编写于 作者: E Eduardo Habkost 提交者: Anthony Liguori

vl.c: Check for NUMA node limit inside numa_add()

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: NEduardo Habkost <ehabkost@redhat.com>
Reviewed-by: NEric Blake <eblake@redhat.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 12e53a9d
......@@ -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:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册