From: Erik Skultety Date: Mon, 11 Aug 2014 14:06:23 +0000 (+0200) Subject: numatune: Fix parsing of empty nodeset (0,^0) X-Git-Tag: v1.2.8-rc1~201 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=983f5a5076edcf738d326df63ead0e48936f0581;p=thirdparty%2Flibvirt.git numatune: Fix parsing of empty nodeset (0,^0) Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1121837 --- diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c index 27282df9e7..b6bd074cf4 100644 --- a/src/util/virbitmap.c +++ b/src/util/virbitmap.c @@ -378,6 +378,9 @@ virBitmapParse(const char *str, } } + if (virBitmapIsAllClear(*bitmap)) + goto error; + return virBitmapCountBits(*bitmap); error: diff --git a/tests/qemuxml2argvdata/qemuxml2argv-numatune-memory-invalid-nodeset.xml b/tests/qemuxml2argvdata/qemuxml2argv-numatune-memory-invalid-nodeset.xml new file mode 100644 index 0000000000..079ca9d5ec --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-numatune-memory-invalid-nodeset.xml @@ -0,0 +1,31 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 2 + + + + + hvm + + + + + + + destroy + restart + destroy + + /usr/bin/qemu + + + +
+ + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 1c121ffd3c..62b969c359 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1210,6 +1210,7 @@ mymain(void) DO_TEST("cputune-zero-shares", QEMU_CAPS_NAME); DO_TEST("numatune-memory", NONE); + DO_TEST_PARSE_ERROR("numatune-memory-invalid-nodeset", NONE); DO_TEST("numatune-memnode", QEMU_CAPS_NUMA, QEMU_CAPS_OBJECT_MEMORY_RAM); DO_TEST_FAILURE("numatune-memnode", NONE);