Patchwork [RESEND,for-1.5] acpi: add dummy write function for acpi timer

login
register
mail settings
Submitter Gerd Hoffmann
Date May 14, 2013, 12:29 p.m.
Message ID <1368534544-11826-1-git-send-email-kraxel@redhat.com>
Download mbox | patch
Permalink /patch/243694/
State New
Headers show

Comments

Gerd Hoffmann - May 14, 2013, 12:29 p.m.
Otherwise the guest can crash qemu (NULL pointer dereference).

https://bugzilla.redhat.com/show_bug.cgi?id=947691

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/acpi/core.c |    7 +++++++
 1 file changed, 7 insertions(+)
Laszlo Ersek - May 14, 2013, 12:45 p.m.
On 05/14/13 14:29, Gerd Hoffmann wrote:
> Otherwise the guest can crash qemu (NULL pointer dereference).
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=947691
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  hw/acpi/core.c |    7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/hw/acpi/core.c b/hw/acpi/core.c
> index 64b8718..42eeace 100644
> --- a/hw/acpi/core.c
> +++ b/hw/acpi/core.c
> @@ -462,8 +462,15 @@ static uint64_t acpi_pm_tmr_read(void *opaque, hwaddr addr, unsigned width)
>      return acpi_pm_tmr_get(opaque);
>  }
>  
> +static void acpi_pm_tmr_write(void *opaque, hwaddr addr, uint64_t val,
> +                              unsigned width)
> +{
> +    /* nothing */
> +}
> +
>  static const MemoryRegionOps acpi_pm_tmr_ops = {
>      .read = acpi_pm_tmr_read,
> +    .write = acpi_pm_tmr_write,
>      .valid.min_access_size = 4,
>      .valid.max_access_size = 4,
>      .endianness = DEVICE_LITTLE_ENDIAN,
> 

(Hopefully the low-hanging fruit impression it makes is not a trap!)

Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Anthony Liguori - May 14, 2013, 4:10 p.m.
Applied.  Thanks.

Regards,

Anthony Liguori

Patch

diff --git a/hw/acpi/core.c b/hw/acpi/core.c
index 64b8718..42eeace 100644
--- a/hw/acpi/core.c
+++ b/hw/acpi/core.c
@@ -462,8 +462,15 @@  static uint64_t acpi_pm_tmr_read(void *opaque, hwaddr addr, unsigned width)
     return acpi_pm_tmr_get(opaque);
 }
 
+static void acpi_pm_tmr_write(void *opaque, hwaddr addr, uint64_t val,
+                              unsigned width)
+{
+    /* nothing */
+}
+
 static const MemoryRegionOps acpi_pm_tmr_ops = {
     .read = acpi_pm_tmr_read,
+    .write = acpi_pm_tmr_write,
     .valid.min_access_size = 4,
     .valid.max_access_size = 4,
     .endianness = DEVICE_LITTLE_ENDIAN,