qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] hw/pci/pci.c: Assert that pci_irq_handler() inputs are valid


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH] hw/pci/pci.c: Assert that pci_irq_handler() inputs are valid
Date: Tue, 23 Mar 2021 21:47:29 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0

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.maydell@linaro.org>
> ---
>  hw/pci/pci.c | 3 +++
>  1 file changed, 3 insertions(+)

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]