[libvirt] [PATCH 23/34] conf: disallow empty cpuset for emulatorpin

Peter Krempa pkrempa at redhat.com
Thu Jan 14 16:27:11 UTC 2016


It's disallowed in the API.
---
 src/conf/domain_conf.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 1036057..e27de96 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -14246,8 +14246,18 @@ virDomainEmulatorPinDefParseXML(xmlNodePtr node)
         return NULL;
     }

-    ignore_value(virBitmapParse(tmp, 0, &def, VIR_DOMAIN_CPUMASK_LEN));
+    if (virBitmapParse(tmp, 0, &def, VIR_DOMAIN_CPUMASK_LEN) < 0)
+        goto cleanup;
+
+    if (virBitmapIsAllClear(def)) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                       _("Invalid value of 'cpuset': %s"), tmp);
+        virBitmapFree(def);
+        def = NULL;
+        goto cleanup;
+    }

+ cleanup:
     VIR_FREE(tmp);
     return def;
 }
-- 
2.6.2




More information about the libvir-list mailing list