Browse Source

boards native_sim: Detect attemtp to configure not existing int

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 <alberto.escolar.piedras@nordicsemi.no>
pull/67835/head
Alberto Escolar Piedras 1 year ago committed by Carles Cufí
parent
commit
e770128c20
  1. 5
      boards/posix/native_sim/irq_handler.c

5
boards/posix/native_sim/irq_handler.c

@ -236,6 +236,11 @@ int posix_get_current_irq(void) @@ -236,6 +236,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;

Loading…
Cancel
Save