Skip to content

Commit 28555ae

Browse files
MaureenHelmhenrikbrixandersen
authored andcommitted
arch: Fix bounds checking for dynamic shared interrupts
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 <[email protected]>
1 parent a6e9f12 commit 28555ae

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/common/shared_irq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ void z_isr_install(unsigned int irq, void (*routine)(const void *),
5050
table_idx = z_get_sw_isr_table_idx(irq);
5151

5252
/* check for out of bounds table index */
53-
if (table_idx >= CONFIG_NUM_IRQS) {
53+
if (table_idx >= IRQ_TABLE_SIZE) {
5454
return;
5555
}
5656

@@ -170,7 +170,7 @@ int z_isr_uninstall(unsigned int irq,
170170
table_idx = z_get_sw_isr_table_idx(irq);
171171

172172
/* check for out of bounds table index */
173-
if (table_idx >= CONFIG_NUM_IRQS) {
173+
if (table_idx >= IRQ_TABLE_SIZE) {
174174
return -EINVAL;
175175
}
176176

0 commit comments

Comments
 (0)