[libvirt] [PATCH] conf: explicitly initialize 'cpumask' variable

Build with clang fails with: CC conf/libvirt_conf_la-domain_conf.lo conf/domain_conf.c:13377:9: error: variable 'cpumask' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized] if (!(tmp = virXMLPropString(node, "cpuset"))) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ and many other similar errors regarding the 'cpuset' variable. Fix by explicitly initializing it with NULL. --- src/conf/domain_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 0b18720..957221b 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -13342,7 +13342,7 @@ virDomainIOThreadPinDefParseXML(xmlNodePtr node, { int ret = -1; virDomainIOThreadIDDefPtr iothrid; - virBitmapPtr cpumask; + virBitmapPtr cpumask = NULL; xmlNodePtr oldnode = ctxt->node; unsigned int iothreadid; char *tmp = NULL; -- 2.3.5

On Tue, Apr 28, 2015 at 08:30:30 +0400, Roman Bogorodskiy wrote:
Build with clang fails with:
CC conf/libvirt_conf_la-domain_conf.lo conf/domain_conf.c:13377:9: error: variable 'cpumask' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized] if (!(tmp = virXMLPropString(node, "cpuset"))) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
and many other similar errors regarding the 'cpuset' variable.
Fix by explicitly initializing it with NULL. ---
ACK, qualifies for both build-breaker and trivial rule. Peter

Peter Krempa wrote:
On Tue, Apr 28, 2015 at 08:30:30 +0400, Roman Bogorodskiy wrote:
Build with clang fails with:
CC conf/libvirt_conf_la-domain_conf.lo conf/domain_conf.c:13377:9: error: variable 'cpumask' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized] if (!(tmp = virXMLPropString(node, "cpuset"))) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
and many other similar errors regarding the 'cpuset' variable.
Fix by explicitly initializing it with NULL. ---
ACK, qualifies for both build-breaker and trivial rule.
Pushed, thanks! Roman Bogorodskiy
participants (2)
-
Peter Krempa
-
Roman Bogorodskiy