From: Michal Privoznik Date: Thu, 10 Oct 2013 10:32:49 +0000 (+0200) Subject: qemu: Init @pcidevs in qemuPrepareHostdevPCIDevices X-Git-Tag: CVE-2013-4401~111 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c228e08175bdd76372c236298ce129d9a64e0d8;p=thirdparty%2Flibvirt.git qemu: Init @pcidevs in qemuPrepareHostdevPCIDevices At the beginning of the function qemuPrepareHostdevPCICheckSupport() is called. After that @pcidevs is initialized. However, if the very first command fails, we go to 'cleanup' label where virObjectUnref(pcidevs) is called. Obviously, it is called before @pcidevs was able to get initialized. Compiler warns about it: CC qemu/libvirt_driver_qemu_impl_la-qemu_hostdev.lo qemu/qemu_hostdev.c: In function 'qemuPrepareHostdevPCIDevices': qemu/qemu_hostdev.c:824:19: error: 'pcidevs' may be used uninitialized in this function [-Werror=maybe-uninitialized] virObjectUnref(pcidevs); ^ cc1: all warnings being treated as errors --- diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c index 81e0e8848c..43c03cce9f 100644 --- a/src/qemu/qemu_hostdev.c +++ b/src/qemu/qemu_hostdev.c @@ -633,7 +633,7 @@ qemuPrepareHostdevPCIDevices(virQEMUDriverPtr driver, int nhostdevs, virQEMUCapsPtr qemuCaps) { - virPCIDeviceListPtr pcidevs; + virPCIDeviceListPtr pcidevs = NULL; int last_processed_hostdev_vf = -1; size_t i; int ret = -1;