From 8ee44f37a59f8d2cc48c3b3c095bb910f23bc681 Mon Sep 17 00:00:00 2001 From: SeokYeon Hwang Date: Tue, 8 Jul 2014 17:37:44 +0900 Subject: [PATCH] emulator: trivial changes Fix "Out-of-bounds read" at pcihp.c Fix error handling at shpc.c Signed-off-by: SeokYeon Hwang --- hw/acpi/pcihp.c | 2 +- hw/pci/shpc.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c index f80c48008c..3351f83486 100644 --- a/hw/acpi/pcihp.c +++ b/hw/acpi/pcihp.c @@ -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; } diff --git a/hw/pci/shpc.c b/hw/pci/shpc.c index 180faa7adb..b01519bff6 100644 --- a/hw/pci/shpc.c +++ b/hw/pci/shpc.c @@ -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; } -- 2.34.1