drivers: pic: Fix PIRQ lookup upper bound

rt_pic_linear_irq() stores irq_nr as a count and assigns pic->pirqs to the first entry in that range. rt_pic_find_pirq() therefore must treat the upper bound as exclusive.

The inclusive check could return pic->pirqs[irq_nr] when irq equals irq_start + irq_nr, which is one entry past the allocated range.

Generated-by: OpenAI Codex
Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
This commit is contained in:
Old-Ding
2026-07-08 14:03:16 +08:00
committed by Rbb666
parent 9e2ab35e17
commit 3eac0a8a17
+1 -1
View File
@@ -280,7 +280,7 @@ struct rt_pic_irq *rt_pic_find_ipi(struct rt_pic *pic, int ipi_index)
struct rt_pic_irq *rt_pic_find_pirq(struct rt_pic *pic, int irq)
{
if (pic && irq >= pic->irq_start && irq <= pic->irq_start + pic->irq_nr)
if (pic && irq >= pic->irq_start && irq < pic->irq_start + pic->irq_nr)
{
return &pic->pirqs[irq - pic->irq_start];
}