Skip to content

Commit 57f7801

Browse files
masz-nordicnashif
authored andcommitted
drivers: ipm: nrfx: add event_index assertion
event_index must be lower than NRFX_IPC_ID_MAX_VALUE. As of now, maximum index is 16. Fixes #20962, #20964, #20967 Signed-off-by: Marcin Szymczyk <[email protected]>
1 parent 61cfab5 commit 57f7801

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/ipm/ipm_nrfx_ipc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ static void nrfx_ipc_handler(u32_t event_mask, void *p_context)
3131
while (event_mask) {
3232
u8_t event_idx = __CLZ(__RBIT(event_mask));
3333

34+
__ASSERT(event_idx < NRFX_IPC_ID_MAX_VALUE,
35+
"Illegal event_idx: %d", event_idx);
3436
event_mask &= ~BIT(event_idx);
3537
nrfx_ipm_data.callback(nrfx_ipm_data.callback_ctx,
3638
event_idx,
@@ -124,6 +126,8 @@ static void vipm_dispatcher(u32_t event_mask, void *p_context)
124126
while (event_mask) {
125127
u8_t event_idx = __CLZ(__RBIT(event_mask));
126128

129+
__ASSERT(event_idx < NRFX_IPC_ID_MAX_VALUE,
130+
"Illegal event_idx: %d", event_idx);
127131
event_mask &= ~BIT(event_idx);
128132
if (nrfx_vipm_data.callback[event_idx] != NULL) {
129133
nrfx_vipm_data.callback[event_idx]

0 commit comments

Comments
 (0)