Skip to content

Commit

Permalink
boards native_posix: Detect attempt to configure not existing int
Browse files Browse the repository at this point in the history
Prevent overrunning the irq vector table.
This is not happening today in tree, but coverity thinks it
may. Checking for it to prevent it is not a bad idea
anyhow, so let's do it.

Signed-off-by: Alberto Escolar Piedras <[email protected]>
  • Loading branch information
aescolar committed Feb 12, 2024
1 parent e81acaf commit 2de9018
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions boards/posix/native_posix/irq_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,11 @@ int posix_get_current_irq(void)
void posix_isr_declare(unsigned int irq_p, int flags, void isr_p(const void *),
const void *isr_param_p)
{
if (irq_p >= N_IRQS) {
posix_print_error_and_exit("Attempted to configure not existent interrupt %u\n",
irq_p);
return;
}
irq_vector_table[irq_p].irq = irq_p;
irq_vector_table[irq_p].func = isr_p;
irq_vector_table[irq_p].param = isr_param_p;
Expand Down

0 comments on commit 2de9018

Please sign in to comment.