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