[libvirt] [PATCH 2/2] cpu_x86: Handle error in x86DataToCPU when calling x86DataAdd

John Ferlan jferlan at redhat.com
Fri Jun 21 19:43:37 UTC 2019


Commit 9c9620af called x86DataAdd without checking for an error,
so add the error checking.

Found by Coverity

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 src/cpu/cpu_x86.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 978a60c90a..55b55da784 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -822,7 +822,8 @@ x86DataToCPU(const virCPUx86Data *data,
         for (blocker = hvModel->blockers; *blocker; blocker++) {
             if ((feature = x86FeatureFind(map, *blocker)) &&
                 !x86DataIsSubset(&copy, &feature->data))
-                x86DataAdd(&modelData, &feature->data);
+                if (x86DataAdd(&modelData, &feature->data) < 0)
+                    goto error;
         }
     }
 
-- 
2.20.1




More information about the libvir-list mailing list