Skip to content

Commit

Permalink
arch: Fix bounds checking for dynamic shared interrupts
Browse files Browse the repository at this point in the history
Fixes z_isr_install() and z_isr_uninstall() routines to check the isr
table index against the correct number of isr table entries. This
prevents out-of-bounds isr table accesses when
CONFIG_GEN_IRQ_START_VECTOR is greater than zero, such as on the ARC
architecture.

Coverity-CID: 347187
Coverity-CID: 347189
Coverity-CID: 347097
Coverity-CID: 347203
Coverity-CID: 347210

Signed-off-by: Maureen Helm <maureen.helm@analog.com>
  • Loading branch information
MaureenHelm authored and henrikbrixandersen committed Feb 19, 2024
1 parent a6e9f12 commit 28555ae
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/common/shared_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void z_isr_install(unsigned int irq, void (*routine)(const void *),
table_idx = z_get_sw_isr_table_idx(irq);

/* check for out of bounds table index */
if (table_idx >= CONFIG_NUM_IRQS) {
if (table_idx >= IRQ_TABLE_SIZE) {
return;
}

Expand Down Expand Up @@ -170,7 +170,7 @@ int z_isr_uninstall(unsigned int irq,
table_idx = z_get_sw_isr_table_idx(irq);

/* check for out of bounds table index */
if (table_idx >= CONFIG_NUM_IRQS) {
if (table_idx >= IRQ_TABLE_SIZE) {
return -EINVAL;
}

Expand Down

0 comments on commit 28555ae

Please sign in to comment.