render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
43fe83
From 4a1972082b79836027e50fcfa90d6e24d784d897 Mon Sep 17 00:00:00 2001
43fe83
Message-Id: <4a1972082b79836027e50fcfa90d6e24d784d897.1382534060.git.jdenemar@redhat.com>
43fe83
From: Michal Privoznik <mprivozn@redhat.com>
43fe83
Date: Thu, 10 Oct 2013 13:56:38 +0200
43fe83
Subject: [PATCH] qemu: Init @pcidevs in qemuPrepareHostdevPCIDevices
43fe83
43fe83
https://bugzilla.redhat.com/show_bug.cgi?id=1001738
43fe83
43fe83
At the beginning of the function qemuPrepareHostdevPCICheckSupport() is
43fe83
called. After that @pcidevs is initialized. However, if the very first
43fe83
command fails, we go to 'cleanup' label where virObjectUnref(pcidevs) is
43fe83
called. Obviously, it is called before @pcidevs was able to get
43fe83
initialized. Compiler warns about it:
43fe83
43fe83
  CC       qemu/libvirt_driver_qemu_impl_la-qemu_hostdev.lo
43fe83
qemu/qemu_hostdev.c: In function 'qemuPrepareHostdevPCIDevices':
43fe83
qemu/qemu_hostdev.c:824:19: error: 'pcidevs' may be used uninitialized in this function [-Werror=maybe-uninitialized]
43fe83
     virObjectUnref(pcidevs);
43fe83
                   ^
43fe83
cc1: all warnings being treated as errors
43fe83
43fe83
(cherry picked from commit 9c228e08175bdd76372c236298ce129d9a64e0d8)
43fe83
43fe83
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
43fe83
---
43fe83
 src/qemu/qemu_hostdev.c | 2 +-
43fe83
 1 file changed, 1 insertion(+), 1 deletion(-)
43fe83
43fe83
diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
43fe83
index 81e0e88..43c03cc 100644
43fe83
--- a/src/qemu/qemu_hostdev.c
43fe83
+++ b/src/qemu/qemu_hostdev.c
43fe83
@@ -633,7 +633,7 @@ qemuPrepareHostdevPCIDevices(virQEMUDriverPtr driver,
43fe83
                              int nhostdevs,
43fe83
                              virQEMUCapsPtr qemuCaps)
43fe83
 {
43fe83
-    virPCIDeviceListPtr pcidevs;
43fe83
+    virPCIDeviceListPtr pcidevs = NULL;
43fe83
     int last_processed_hostdev_vf = -1;
43fe83
     size_t i;
43fe83
     int ret = -1;
43fe83
-- 
43fe83
1.8.4
43fe83