mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-10-02 14:23:19 +08:00
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:
@@ -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];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user