aboutsummaryrefslogtreecommitdiff
path: root/hw/pci
diff options
context:
space:
mode:
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2020-10-24 22:39:00 +0200
committerMichael S. Tsirkin <mst@redhat.com>2020-10-30 04:29:13 -0400
commit459ca8bfa41b42b9d80739929f09f792207f15f3 (patch)
tree013cf643c2aa1722cf61e2a0b05f126248eb1dae /hw/pci
parentb06fe3e703f833866914c03c3fb0acc02385c824 (diff)
downloadqemu-459ca8bfa41b42b9d80739929f09f792207f15f3.zip
qemu-459ca8bfa41b42b9d80739929f09f792207f15f3.tar.gz
qemu-459ca8bfa41b42b9d80739929f09f792207f15f3.tar.bz2
pci: Assert irqnum is between 0 and bus->nirqs in pci_bus_change_irq_level
These assertions similar to those in the adjacent pci_bus_get_irq_level() function ensure that irqnum lies within the valid PCI bus IRQ range. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Message-Id: <20201011082022.3016-1-mark.cave-ayland@ilande.co.uk> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20201024203900.3619498-3-f4bug@amsat.org> Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/pci')
-rw-r--r--hw/pci/pci.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 081ddca..dc40198 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -250,6 +250,8 @@ static inline void pci_set_irq_state(PCIDevice *d, int irq_num, int level)
static void pci_bus_change_irq_level(PCIBus *bus, int irq_num, int change)
{
+ assert(irq_num >= 0);
+ assert(irq_num < bus->nirq);
bus->irq_count[irq_num] += change;
bus->set_irq(bus->irq_opaque, irq_num, bus->irq_count[irq_num] != 0);
}