6ae9ed
From 70b18a664f73f36641c8b6db8b7ac57715d4f187 Mon Sep 17 00:00:00 2001
6ae9ed
Message-Id: <70b18a664f73f36641c8b6db8b7ac57715d4f187@dist-git>
6ae9ed
From: Peter Krempa <pkrempa@redhat.com>
6ae9ed
Date: Fri, 26 Aug 2016 15:45:28 -0400
6ae9ed
Subject: [PATCH] conf: Fix build with picky GCC
6ae9ed
6ae9ed
https://bugzilla.redhat.com/show_bug.cgi?id=1097930
6ae9ed
https://bugzilla.redhat.com/show_bug.cgi?id=1224341
6ae9ed
6ae9ed
../../src/conf/domain_conf.c:4425:21: error: potential null pointer dereference [-Werror=null-dereference]
6ae9ed
         switch (vcpu->hotpluggable) {
6ae9ed
                 ~~~~^~~~~~~~~~~~~~
6ae9ed
6ae9ed
(cherry picked from commit 9cf086be6d916c52035a0ee89f3f0f020e9fee1f)
6ae9ed
---
6ae9ed
 src/conf/domain_conf.c | 4 ++++
6ae9ed
 1 file changed, 4 insertions(+)
6ae9ed
6ae9ed
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
6ae9ed
index 9c49ba7..261684e 100644
6ae9ed
--- a/src/conf/domain_conf.c
6ae9ed
+++ b/src/conf/domain_conf.c
6ae9ed
@@ -4515,6 +4515,10 @@ virDomainVcpuDefPostParse(virDomainDefPtr def)
6ae9ed
     for (i = 0; i < maxvcpus; i++) {
6ae9ed
         vcpu = virDomainDefGetVcpu(def, i);
6ae9ed
 
6ae9ed
+        /* impossible but some compilers don't like it */
6ae9ed
+        if (!vcpu)
6ae9ed
+            continue;
6ae9ed
+
6ae9ed
         switch (vcpu->hotpluggable) {
6ae9ed
         case VIR_TRISTATE_BOOL_ABSENT:
6ae9ed
             if (vcpu->online)
6ae9ed
-- 
6ae9ed
2.10.0
6ae9ed