From c214f56a8264114145f9e1b79b10b72aa079e44a Mon Sep 17 00:00:00 2001 From: John Ferlan Date: Mon, 18 May 2015 08:42:46 -0400 Subject: [PATCH] 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 --- src/conf/domain_conf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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;