libvirt/src/qemu
Eric Blake 0d166c6b7c build: detect potentential uninitialized variables
Even with -Wuninitialized (which is part of autobuild.sh
--enable-compile-warnings=error), gcc does NOT catch this
use of an uninitialized variable:

{
  if (cond)
    goto error;
  int a = 1;
error:
  printf("%d", a);
}

which prints 0 (supposing the stack started life wiped) if
cond was true.  Clang will catch it, but we don't use clang
as often.  Using gcc -Wjump-misses-init catches it, but also
gives false positives:

{
  if (cond)
    goto error;
  int a = 1;
  return a;
error:
  return 0;
}

Here, a was never used in the scope of the error block, so
declaring it after goto is technically fine (and clang agrees).
However, given that our HACKING already documents a preference
to C89 decl-before-statement, the false positive warning is
enough of a prod to comply with HACKING.

[Personally, I'd _really_ rather use C99 decl-after-statement
to minimize scope, but until gcc can efficiently and reliably
catch scoping and uninitialized usage bugs, I'll settle with
the compromise of enforcing a coding standard that happens to
reject false positives if it can also detect real bugs.]

* acinclude.m4 (LIBVIRT_COMPILE_WARNINGS): Add -Wjump-misses-init.
* src/util/util.c (__virExec): Adjust offenders.
* src/conf/domain_conf.c (virDomainTimerDefParseXML): Likewise.
* src/remote/remote_driver.c (doRemoteOpen): Likewise.
* src/phyp/phyp_driver.c (phypGetLparNAME, phypGetLparProfile)
(phypGetVIOSFreeSCSIAdapter, phypVolumeGetKey)
(phypGetStoragePoolDevice)
(phypVolumeGetPhysicalVolumeByStoragePool)
(phypVolumeGetPath): Likewise.
* src/vbox/vbox_tmpl.c (vboxNetworkUndefineDestroy)
(vboxNetworkCreate, vboxNetworkDumpXML)
(vboxNetworkDefineCreateXML): Likewise.
* src/xenapi/xenapi_driver.c (getCapsObject)
(xenapiDomainDumpXML): Likewise.
* src/xenapi/xenapi_utils.c (createVMRecordFromXml): Likewise.
* src/security/security_selinux.c (SELinuxGenNewContext):
Likewise.
* src/qemu/qemu_command.c (qemuBuildCommandLine): Likewise.
* src/qemu/qemu_hotplug.c (qemuDomainChangeEjectableMedia):
Likewise.
* src/qemu/qemu_process.c (qemuProcessWaitForMonitor): Likewise.
* src/qemu/qemu_monitor_text.c (qemuMonitorTextGetPtyPaths):
Likewise.
* src/qemu/qemu_driver.c (qemudDomainShutdown)
(qemudDomainBlockStats, qemudDomainMemoryPeek): Likewise.
* src/storage/storage_backend_iscsi.c
(virStorageBackendCreateIfaceIQN): Likewise.
* src/node_device/node_device_udev.c (udevProcessPCI): Likewise.
2011-04-04 11:26:29 -06:00
..
libvirtd_qemu.aug qemu: fix augeas support for vnc_auto_unix_socket 2011-01-28 15:28:30 -07:00
qemu_audit.c audit: audit use of /dev/net/tun, /dev/tapN, /dev/vhost-net 2011-03-10 08:35:42 -07:00
qemu_audit.h audit: audit use of /dev/net/tun, /dev/tapN, /dev/vhost-net 2011-03-10 08:35:42 -07:00
qemu_bridge_filter.c Remove conn parameter from virReportSystemError 2010-02-09 01:04:54 +01:00
qemu_bridge_filter.h build: consistently indent preprocessor directives 2010-03-09 19:22:28 +01:00
qemu_capabilities.c maint: prohibit access(,X_OK) 2011-03-24 15:18:44 -06:00
qemu_capabilities.h qemu: Support vram for video of qxl type 2011-03-06 22:00:27 +08:00
qemu_cgroup.c qemu: Fix improper logic of qemuCgroupSetup 2011-04-01 11:41:33 +08:00
qemu_cgroup.h audit: prepare qemu for listing vm in cgroup audits 2011-02-24 13:31:05 -07:00
qemu_command.c build: detect potentential uninitialized variables 2011-04-04 11:26:29 -06:00
qemu_command.h audit: audit use of /dev/net/tun, /dev/tapN, /dev/vhost-net 2011-03-10 08:35:42 -07:00
qemu_conf.c qemu: Implement blkio tunable XML configuration and parsing. 2011-02-08 11:43:45 -07:00
qemu_conf.h Put <stdbool.h> into internal.h so it is available everywhere 2011-02-24 12:04:06 +00:00
qemu_domain.c build: enforce reference count checking 2011-03-24 15:29:18 -06:00
qemu_domain.h Wire up virDomainMigrateSetSpeed into QEMU driver 2011-03-22 15:53:08 +00:00
qemu_driver.c build: detect potentential uninitialized variables 2011-04-04 11:26:29 -06:00
qemu_driver.h Split all QEMU process mangement code into separate file 2011-02-17 12:48:55 +00:00
qemu_hostdev.c Move QEMU hostdev helper code out of the QEMU driver 2010-12-17 13:50:21 +00:00
qemu_hostdev.h Move QEMU hostdev helper code out of the QEMU driver 2010-12-17 13:50:21 +00:00
qemu_hotplug.c build: detect potentential uninitialized variables 2011-04-04 11:26:29 -06:00
qemu_hotplug.h rename qemuDomainDetachSCSIDiskDevice to qemuDomainDetachDiskDevice 2011-03-07 11:28:15 -07:00
qemu_migration.c qemu: fix regression with fd labeling on migration 2011-03-29 07:12:29 -06:00
qemu_migration.h qemu: consolidate migration to file code 2011-03-28 10:26:33 -06:00
qemu_monitor_json.c check whether qemuMonitorJSONHMP() failed 2011-03-30 16:32:22 +08:00
qemu_monitor_json.h qemu: Detect support for HMP passthrough 2011-03-22 15:03:57 +01:00
qemu_monitor_text.c build: detect potentential uninitialized variables 2011-04-04 11:26:29 -06:00
qemu_monitor_text.h qemu: consolidate duplicated monitor migration code 2011-03-14 21:57:43 -06:00
qemu_monitor.c check whether qemuMonitorJSONHMP() failed 2011-03-30 16:32:22 +08:00
qemu_monitor.h build: enforce reference count checking 2011-03-24 15:29:18 -06:00
qemu_process.c build: detect potentential uninitialized variables 2011-04-04 11:26:29 -06:00
qemu_process.h Split all QEMU process mangement code into separate file 2011-02-17 12:48:55 +00:00
qemu.conf qemu: don't request cgroup ACL access for /dev/net/tun 2011-03-10 08:32:43 -07:00
test_libvirtd_qemu.aug qemu: fix augeas support for vnc_auto_unix_socket 2011-01-28 15:28:30 -07:00
THREADS.txt docs: more on qemu locking patterns 2011-02-02 09:19:31 -07:00