From: John Ferlan Date: Mon, 18 May 2015 12:42:46 +0000 (-0400) Subject: conf: Resolve Coverity NEGATIVE_RETURNS X-Git-Tag: v1.2.16-rc1~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c214f56a8264114145f9e1b79b10b72aa079e44a;p=thirdparty%2Flibvirt.git conf: Resolve Coverity NEGATIVE_RETURNS Commit id '73eda710' added virDomainKeyWrapDefParseXML which uses virXPathNodeSet, but does not handle a -1 return thus causing a possible loop condition exit problem later when the return value is used. Change the logic to return the value from virXPathNodeSet if <= 0 --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d5207b1207..0a3a6245ae 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -942,8 +942,8 @@ virDomainKeyWrapDefParseXML(virDomainDefPtr def, xmlXPathContextPtr ctxt) xmlNodePtr *nodes = NULL; int n; - if (!(n = virXPathNodeSet("./keywrap/cipher", ctxt, &nodes))) - return 0; + if ((n = virXPathNodeSet("./keywrap/cipher", ctxt, &nodes)) < 0) + return n; if (VIR_ALLOC(def->keywrap) < 0) goto cleanup;