emulator: trivial changes
authorSeokYeon Hwang <syeon.hwang@samsung.com>
Tue, 8 Jul 2014 08:37:44 +0000 (17:37 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Tue, 8 Jul 2014 08:37:44 +0000 (17:37 +0900)
Fix "Out-of-bounds read" at pcihp.c
Fix error handling at shpc.c

Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
hw/acpi/pcihp.c
hw/pci/shpc.c

index f80c48008cb3aab6a0d5d1b0dcc4960c363d5f49..3351f8348647b7a4202b1f0141bd93fd0e5a4ee4 100644 (file)
@@ -229,7 +229,7 @@ static uint64_t pci_read(void *opaque, hwaddr addr, unsigned int size)
     uint32_t val = 0;
     int bsel = s->hotplug_select;
 
-    if (bsel < 0 || bsel > ACPI_PCIHP_MAX_HOTPLUG_BUS) {
+    if (bsel < 0 || bsel >= ACPI_PCIHP_MAX_HOTPLUG_BUS) {
         return 0;
     }
 
index 180faa7adbdd6c800bfccc8b057e6e38e925db2f..b01519bff60292ac01b7f1999126d84f4739405e 100644 (file)
@@ -559,8 +559,9 @@ void shpc_device_hot_unplug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
     uint8_t led;
     int slot;
 
-    shpc_device_hotplug_common(PCI_DEVICE(dev), &slot, shpc, errp);
+    shpc_device_hotplug_common(PCI_DEVICE(dev), &slot, shpc, &local_err);
     if (local_err) {
+        error_propagate(errp, local_err);
         return;
     }