All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH for-2.4] acpi: avoid potential uninitialized access to cpu_hp_io_base
@ 2015-07-31 10:14 Daniel P. Berrange
  2015-07-31 12:53 ` Igor Mammedov
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel P. Berrange @ 2015-07-31 10:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Michael S. Tsirkin

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>
---
 hw/i386/acpi-build.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 46eddb8..95e0c65 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) {
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH for-2.4] acpi: avoid potential uninitialized access to cpu_hp_io_base
  2015-07-31 10:14 [Qemu-devel] [PATCH for-2.4] acpi: avoid potential uninitialized access to cpu_hp_io_base Daniel P. Berrange
@ 2015-07-31 12:53 ` Igor Mammedov
  0 siblings, 0 replies; 2+ messages in thread
From: Igor Mammedov @ 2015-07-31 12:53 UTC (permalink / raw)
  To: Daniel P. Berrange; +Cc: Paolo Bonzini, qemu-devel, Michael S. Tsirkin

On Fri, 31 Jul 2015 11:14:35 +0100
"Daniel P. Berrange" <berrange@redhat.com> wrote:

> 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>
Impossible in practice since piix or lpc branches will initialize it,
but there is no harm in making compiler happy.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>

> ---
>  hw/i386/acpi-build.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index 46eddb8..95e0c65 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) {

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-07-31 12:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-31 10:14 [Qemu-devel] [PATCH for-2.4] acpi: avoid potential uninitialized access to cpu_hp_io_base Daniel P. Berrange
2015-07-31 12:53 ` Igor Mammedov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.