[libvirt] [PATCH v2 RESEND 16/17] conf: Add return value check to virResctrlAllocForeachCache

bing.niu@intel.com posted 17 patches 6 years, 9 months ago
[libvirt] [PATCH v2 RESEND 16/17] conf: Add return value check to virResctrlAllocForeachCache
Posted by bing.niu@intel.com 6 years, 9 months ago
From: Bing Niu <bing.niu@intel.com>

Add return value check to virResctrlAllocForeachCache in
virDomainCachetuneDefFormat. The virResctrlAllocForeachCache dose have
return value, so need check return value to make sure function executed
without error.

Signed-off-by: Bing Niu <bing.niu@intel.com>
---
 src/conf/domain_conf.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index d8333ad..095c903 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -27199,10 +27199,10 @@ virDomainCachetuneDefFormat(virBufferPtr buf,
     int ret = -1;
 
     virBufferSetChildIndent(&childrenBuf, buf);
-    virResctrlAllocForeachCache(resctrl->alloc,
-                                virDomainCachetuneDefFormatHelper,
-                                &childrenBuf);
-
+    if (virResctrlAllocForeachCache(resctrl->alloc,
+                                    virDomainCachetuneDefFormatHelper,
+                                    &childrenBuf) < 0)
+        goto cleanup;
 
     if (virBufferCheckError(&childrenBuf) < 0)
         goto cleanup;
-- 
2.7.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 RESEND 16/17] conf: Add return value check to virResctrlAllocForeachCache
Posted by John Ferlan 6 years, 9 months ago

On 07/29/2018 11:12 PM, bing.niu@intel.com wrote:
> From: Bing Niu <bing.niu@intel.com>
> 
> Add return value check to virResctrlAllocForeachCache in
> virDomainCachetuneDefFormat. The virResctrlAllocForeachCache dose have

s/dose/does/

> return value, so need check return value to make sure function executed
> without error.
> 
> Signed-off-by: Bing Niu <bing.niu@intel.com>
> ---
>  src/conf/domain_conf.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 

I'll fix in my branch before pushing

John

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list