Skip to contentSkip to conversation

acpi: add dummy write function for acpi timer

PATCH RESEND Applied Gerd Hoffmann 3 participants 3 messages May 14, 2013

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 acpi: add dummy write function for acpi timer

Otherwise the guest can crash qemu (NULL pointer dereference).

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

---
 hw/acpi/core.c |    7 +++++++
 1 file changed, 7 insertions(+)
hw/acpi/core.c +7 -0
index 64b8718..42eeace 100644
@@ -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,
Signature · 1 line
1.7.9.7
Reviewed-by on v1 1/1
#1 lore raw
Quoted 20 lines · Gerd Hoffmann

Otherwise the guest can crash qemu (NULL pointer dereference).

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

---
 hw/acpi/core.c |    7 +++++++
 1 file changed, 7 insertions(+)
hw/acpi/core.c +2 -0
index 64b8718..42eeace 100644
@@ -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)

hw/acpi/core.c static uint64_t acpi_pm_tmr_read(void *opaque, hwaddr addr, unsigned width) · line 476

Quoted 10 lines
hw/acpi/core.c +5 -0
+{
+    /* 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!)