From: Gonglei Date: Wed, 20 Aug 2014 05:52:30 +0000 (+0800) Subject: pcihp: fix possible array out of bounds X-Git-Tag: qemu-xen-4.5.1-rc1~4 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=94d09f22b790648493038f964d2fc171b26f52f5;p=qemu-upstream-4.5-testing.git pcihp: fix possible array out of bounds Prevent out-of-bounds array access on acpi_pcihp_pci_status. Signed-off-by: Gonglei Reviewed-by: Peter Crosthwaite Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Cc: qemu-stable@nongnu.org Reviewed-by: Marcel Apfelbaum --- diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c index f80c48008..3351f8348 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; }