From: Chen Fan Date: Fri, 7 Nov 2014 08:54:56 +0000 (+0800) Subject: virnuma: add nodeset NULL check in virNumaSetupMemoryPolicy X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=fc313364b19be6a3662d5301e195b898d6662087;p=libvirt.git virnuma: add nodeset NULL check in virNumaSetupMemoryPolicy 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 --- diff --git a/src/util/virnuma.c b/src/util/virnuma.c index 06520f78eb..b8d76f4074 100644 --- a/src/util/virnuma.c +++ b/src/util/virnuma.c @@ -97,6 +97,9 @@ virNumaSetupMemoryPolicy(virDomainNumatuneMemMode mode, size_t i; int maxnode = 0; + if (!nodeset) + return 0; + if (!virNumaNodesetIsAvailable(nodeset)) return -1;