From cd23fdf63fd3d15f38f29686fc29454b1d07a2ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 27 Jan 2025 09:38:11 +0100 Subject: [PATCH] boards: nrf*_bsim: Detect attempt to configure not existing int MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Similar to 923d4fbad8. Prevent overrunning the irq vector table. This is not happening today in tree, but coverity thinks it does. Checking for it to prevent it is not a bad idea anyhow, so let's do it. Signed-off-by: Krzysztof Chruściński --- boards/native/nrf_bsim/irq_handler.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/boards/native/nrf_bsim/irq_handler.c b/boards/native/nrf_bsim/irq_handler.c index 2d6ad4f66b7..74d0dc5889e 100644 --- a/boards/native/nrf_bsim/irq_handler.c +++ b/boards/native/nrf_bsim/irq_handler.c @@ -278,6 +278,11 @@ void posix_isr_declare(unsigned int irq_p, int flags, void isr_p(const void *), */ void posix_irq_priority_set(unsigned int irq, unsigned int prio, uint32_t flags) { + if (irq >= NHW_INTCTRL_MAX_INTLINES) { + bs_trace_error_time_line("Attempted to configure not existent interrupt %u\n", + irq); + return; + } hw_irq_ctrl_prio_set(CONFIG_NATIVE_SIMULATOR_MCU_N, irq, prio); }