summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2015-07-31 11:14:35 +0100
committerMichael S. Tsirkin <mst@redhat.com>2015-08-13 14:08:30 +0300
commit94aaca6457e52bb9c8a53af3c89bfeec40afadfc (patch)
tree76c85edd9230359d91e4d9dba7807f4d19dfde82
parentbd89dd98b2b835bbff43f02f2e7c823eb0c61331 (diff)
downloadfocaccia-qemu-94aaca6457e52bb9c8a53af3c89bfeec40afadfc.tar.gz
focaccia-qemu-94aaca6457e52bb9c8a53af3c89bfeec40afadfc.zip
acpi: avoid potential uninitialized access to cpu_hp_io_base
When building QEMU with Mingw64 toolchain I see a warning

 CC    x86_64-softmmu/hw/i386/acpi-build.o
  hw/i386/acpi-build.c: In function 'acpi_build':
  hw/i386/acpi-build.c:1138:9: warning: 'pm.cpu_hp_io_base' may be used uninitialized in this function [-Wmaybe-uninitialized]
           aml_append(crs,
           ^
  hw/i386/acpi-build.c:1666:16: note: 'pm.cpu_hp_io_base' was declared here
       AcpiPmInfo pm;
                  ^

In acpi_get_pm_info() some of the fields are pre-initialized
to 0, but this one was missed.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
-rw-r--r--hw/i386/acpi-build.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 46eddb8e48..95e0c657a7 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -169,6 +169,7 @@ static void acpi_get_pm_info(AcpiPmInfo *pm)
     Object *obj = NULL;
     QObject *o;
 
+    pm->cpu_hp_io_base = 0;
     pm->pcihp_io_base = 0;
     pm->pcihp_io_len = 0;
     if (piix) {