diff options
| author | Old-Ding <[email protected]> | 2026-07-06 11:07:07 +0800 |
|---|---|---|
| committer | Rbb666 <[email protected]> | 2026-07-08 14:03:16 +0800 |
| commit | 3eac0a8a17dd425b0696b0155adfdda2b78af1d9 (patch) | |
| tree | b5754d8d1abceb1caa1998478cc3940c2e6ff7c0 | |
| parent | 9e2ab35e173afe07785f3f2fb1a2fdad54cd47a6 (diff) | |
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 <[email protected]>
| -rw-r--r-- | components/drivers/pic/pic.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/components/drivers/pic/pic.c b/components/drivers/pic/pic.c index f3850ebd48..cb00b369c9 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]; } |
