]> xenbits.xensource.com Git - libvirt.git/commitdiff
virnuma: add nodeset NULL check in virNumaSetupMemoryPolicy
authorChen Fan <chen.fan.fnst@cn.fujitsu.com>
Fri, 7 Nov 2014 08:54:56 +0000 (16:54 +0800)
committerMartin Kletzander <mkletzan@redhat.com>
Fri, 7 Nov 2014 11:04:57 +0000 (12:04 +0100)
Introduced by commit c63ef0452b, when nodeset is NULL, validation will
pass in virNumaSetupMemoryPolicy, but virBitmapNextSetBit must ensure
bitmap is not NULL, otherwise that might cause a segmentation fault.
This patch fixes it.

Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
src/util/virnuma.c

index 06520f78eb173214a62b13e91993784c2bb97cd4..b8d76f4074b94cb8be857e3b26e3b4c846d75634 100644 (file)
@@ -97,6 +97,9 @@ virNumaSetupMemoryPolicy(virDomainNumatuneMemMode mode,
     size_t i;
     int maxnode = 0;
 
+    if (!nodeset)
+        return 0;
+
     if (!virNumaNodesetIsAvailable(nodeset))
         return -1;