99cbc7
From 7a8c614b37e0d7e1b2eac08a72f46ef715b72c5a Mon Sep 17 00:00:00 2001
99cbc7
Message-Id: <7a8c614b37e0d7e1b2eac08a72f46ef715b72c5a@dist-git>
99cbc7
From: Bing Niu <bing.niu@intel.com>
99cbc7
Date: Mon, 15 Apr 2019 17:32:59 +0200
99cbc7
Subject: [PATCH] conf: Add return value check to virResctrlAllocForeachCache
99cbc7
MIME-Version: 1.0
99cbc7
Content-Type: text/plain; charset=UTF-8
99cbc7
Content-Transfer-Encoding: 8bit
99cbc7
99cbc7
Add return value check to virResctrlAllocForeachCache in
99cbc7
virDomainCachetuneDefFormat. The virResctrlAllocForeachCache does have
99cbc7
return value, so need check return value to make sure function executed
99cbc7
without error.
99cbc7
99cbc7
Signed-off-by: Bing Niu <bing.niu@intel.com>
99cbc7
Reviewed-by: John Ferlan <jferlan@redhat.com>
99cbc7
(cherry picked from commit 8d6f508e64728f9aaa5a624462ac0da325854cad)
99cbc7
99cbc7
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1468650
99cbc7
99cbc7
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
99cbc7
Message-Id: <bfb8991c4b538b9ef5a2742370ab5f826a75fac2.1555342313.git.phrdina@redhat.com>
99cbc7
Reviewed-by: Ján Tomko <jtomko@redhat.com>
99cbc7
---
99cbc7
 src/conf/domain_conf.c | 8 ++++----
99cbc7
 1 file changed, 4 insertions(+), 4 deletions(-)
99cbc7
99cbc7
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
99cbc7
index 2f56c077a9..74781fe596 100644
99cbc7
--- a/src/conf/domain_conf.c
99cbc7
+++ b/src/conf/domain_conf.c
99cbc7
@@ -27258,10 +27258,10 @@ virDomainCachetuneDefFormat(virBufferPtr buf,
99cbc7
     int ret = -1;
99cbc7
 
99cbc7
     virBufferSetChildIndent(&childrenBuf, buf);
99cbc7
-    virResctrlAllocForeachCache(resctrl->alloc,
99cbc7
-                                virDomainCachetuneDefFormatHelper,
99cbc7
-                                &childrenBuf);
99cbc7
-
99cbc7
+    if (virResctrlAllocForeachCache(resctrl->alloc,
99cbc7
+                                    virDomainCachetuneDefFormatHelper,
99cbc7
+                                    &childrenBuf) < 0)
99cbc7
+        goto cleanup;
99cbc7
 
99cbc7
     if (virBufferCheckError(&childrenBuf) < 0)
99cbc7
         goto cleanup;
99cbc7
-- 
99cbc7
2.21.0
99cbc7