提交 c03417b4 编写于 作者: M Markus Armbruster 提交者: Anthony Liguori

vl: Tighten parsing of -numa's parameter mem

strtosz_suffix() fails unless the size is followed by 0, whitespace or
','.  Useless here, because we need to fail for any junk following the
size, even if it starts with whitespace or ','.  Check manually.

Things like

    -smp 4 -numa "node,mem=1024,cpus=0-1" -numa "node,mem=1024 cpus=2-3"

are now caught.  Before, the second -numa's argument was silently
interpreted as just "node,mem=1024".
Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 8dddfb55
......@@ -953,8 +953,8 @@ static void numa_add(const char *optarg)
node_mem[nodenr] = 0;
} else {
int64_t sval;
sval = strtosz(option, NULL);
if (sval < 0) {
sval = strtosz(option, &endptr);
if (sval < 0 || *endptr) {
fprintf(stderr, "qemu: invalid numa mem size: %s\n", optarg);
exit(1);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册