[PATCH] hw/isa/isa-bus: Use ISA_NUM_IRQS instead of magic number

Philippe Mathieu-Daudé posted 1 patch 4 years, 3 months ago
Test asan failed
Test checkpatch passed
Test FreeBSD failed
Test docker-mingw@fedora failed
Test docker-clang@ubuntu failed
Test docker-quick@centos7 failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20191213105921.9529-1-philmd@redhat.com
hw/isa/isa-bus.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] hw/isa/isa-bus: Use ISA_NUM_IRQS instead of magic number
Posted by Philippe Mathieu-Daudé 4 years, 3 months ago
We have a definition for the number of ISA IRQs, use it.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/isa/isa-bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c
index 388800603b..1d79ed133c 100644
--- a/hw/isa/isa-bus.c
+++ b/hw/isa/isa-bus.c
@@ -85,7 +85,7 @@ void isa_bus_irqs(ISABus *bus, qemu_irq *irqs)
 qemu_irq isa_get_irq(ISADevice *dev, int isairq)
 {
     assert(!dev || ISA_BUS(qdev_get_parent_bus(DEVICE(dev))) == isabus);
-    if (isairq < 0 || isairq > 15) {
+    if (isairq < 0 || isairq > >= ISA_NUM_IRQS) {
         hw_error("isa irq %d invalid", isairq);
     }
     return isabus->irqs[isairq];
-- 
2.21.0


Re: [PATCH] hw/isa/isa-bus: Use ISA_NUM_IRQS instead of magic number
Posted by Philippe Mathieu-Daudé 4 years, 3 months ago
On 12/13/19 11:59 AM, Philippe Mathieu-Daudé wrote:
> We have a definition for the number of ISA IRQs, use it.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>   hw/isa/isa-bus.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c
> index 388800603b..1d79ed133c 100644
> --- a/hw/isa/isa-bus.c
> +++ b/hw/isa/isa-bus.c
> @@ -85,7 +85,7 @@ void isa_bus_irqs(ISABus *bus, qemu_irq *irqs)
>   qemu_irq isa_get_irq(ISADevice *dev, int isairq)
>   {
>       assert(!dev || ISA_BUS(qdev_get_parent_bus(DEVICE(dev))) == isabus);
> -    if (isairq < 0 || isairq > 15) {
> +    if (isairq < 0 || isairq > >= ISA_NUM_IRQS) {

Oops, Pablo was quicker than patchew to notice this buggy patch =)

I messed when copy/pasting from a bigger series :/

So no need to review further.

>           hw_error("isa irq %d invalid", isairq);
>       }
>       return isabus->irqs[isairq];
>