Skip to content

Commit 60d8b2f

Browse files
yongxu-wang15kartben
authored andcommitted
soc: nxp: imx943: Fix potential out-of-bounds access in pm_mcore loop
Limit the loop to the smaller of nvic_iser_nb and GPC_CPU_CTRL_CMC_IRQ_WAKEUP_MASK_COUNT to ensure safe access. Signed-off-by: Yongxu Wang <[email protected]>
1 parent 7899951 commit 60d8b2f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

soc/nxp/imx/imx9/imx943/pm_mcore.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ static void pm_state_before(void)
3636
};
3737

3838
/* IRQs enabled at NVIC level become GPC wake sources */
39-
for (uint32_t idx = 0; idx < nvic_iser_nb; idx++) {
39+
for (uint32_t idx = 0; idx <
40+
MIN(GPC_CPU_CTRL_CMC_IRQ_WAKEUP_MASK_COUNT, nvic_iser_nb); idx++) {
4041
wake_mask[idx] = ~(NVIC->ISER[idx]);
4142
}
4243

0 commit comments

Comments
 (0)