From ce03012ecfb2f9e52616e4f6e3336c68a5ec0221 Mon Sep 17 00:00:00 2001 From: Old-Ding <35417409+Old-Ding@users.noreply.github.com> Date: Mon, 6 Jul 2026 11:07:07 +0800 Subject: [PATCH] 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> --- components/drivers/pic/pic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/drivers/pic/pic.c b/components/drivers/pic/pic.c index f3850ebd484..cb00b369c97 100644 --- a/components/drivers/pic/pic.c +++ b/components/drivers/pic/pic.c @@ -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]; }