From: Zheng Huang <hz1624917200@gmail.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>, qemu-devel@nongnu.org
Subject: Re: [PATCH] hw/audio/cs4231a: fix assertion error in isa_bus_get_irq
Date: Fri, 9 May 2025 19:37:59 +0800 [thread overview]
Message-ID: <3a4366b3-7eaa-4578-b0f2-f68bd0f86cc4@gmail.com> (raw)
In-Reply-To: <6222ad86-ef37-49f8-9e89-997208123c99@linaro.org>
Hi Philippe,
On 2025/5/9 19:28, Philippe Mathieu-Daudé wrote:
> Hi Zheng,
>
> On 9/5/25 13:15, Zheng Huang wrote:
>> This patch fixes an assertion error in isa_bus_get_irq() in
>> /hw/isa/isa-bus.c by adding a constraint to the irq property.
>
> Can you provide a reproducer to trigger that?
>
Sure, this bug occures when start qemu with:
```bash
qemu-system-x86_64 -display none -machine accel=qtest -m 64 -M pc -nodefaults -audiodev none,id=snd0 -nodefaults -device cs4231a,audiodev=snd0,irq=17
```
and error message following:
qemu-system-x86_64: ../hw/isa/isa-bus.c:84: qemu_irq isa_bus_get_irq(ISABus *, unsigned int): Assertion `irqnum < ISA_NUM_IRQS' failed.
Besides, pls refer to patch v2, in which I updated the constraint.
>>
>> Signed-off-by: Zheng Huang <hz1624917200@gmail.com>
>> ---
>> hw/audio/cs4231a.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/hw/audio/cs4231a.c b/hw/audio/cs4231a.c
>> index 5a9be80ba3..d390da4c37 100644
>> --- a/hw/audio/cs4231a.c
>> +++ b/hw/audio/cs4231a.c
>> @@ -682,6 +682,10 @@ static void cs4231a_realizefn (DeviceState *dev, Error **errp)
>> return;
>> }
>> + if (s->irq >= ISA_NUM_IRQS) {
>> + error_setg(errp, "Invalid IRQ %d (max %d)", s->irq, ISA_NUM_IRQS);
>> + return;
>> + }
>> s->pic = isa_bus_get_irq(bus, s->irq);
>> k = ISADMA_GET_CLASS(s->isa_dma);
>> k->register_channel(s->isa_dma, s->dma, cs_dma_read, s);
>
prev parent reply other threads:[~2025-05-09 11:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-09 11:15 [PATCH] hw/audio/cs4231a: fix assertion error in isa_bus_get_irq Zheng Huang
2025-05-09 11:28 ` Philippe Mathieu-Daudé
2025-05-09 11:37 ` Zheng Huang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3a4366b3-7eaa-4578-b0f2-f68bd0f86cc4@gmail.com \
--to=hz1624917200@gmail.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).