On 3/23/21 5:46 PM, Peter Maydell wrote: > pci_irq_handler documents that it must be called with 0 <= irq_num <= > 3 and level either 0 or 1. Add assertions that the caller has passed > us in valid arguments. > > In particular, if a device model fails to set the PCI_INTERRUPT_PIN > field in its config space correctly to indicate that it has an > interrupt, and then tries to raise an interrupt (either by calling > pci_set_irq(), or by getting a qemu_irq from pci_allocate_irq() and > then calling qemu_set_irq() on that) we will now diagnose this device > model bug with an assertion rather than engaging in the undefined > behaviour of shifting by a negative number. > > Signed-off-by: Peter Maydell <peter.mayd...@linaro.org> > --- > hw/pci/pci.c | 3 +++ > 1 file changed, 3 insertions(+)
Reviewed-by: Philippe Mathieu-Daudé <f4...@amsat.org>