From 96dfed029db8775a2cff76dc38d167fa7abc98b3 Mon Sep 17 00:00:00 2001 From: Peter Bigot Date: Mon, 1 Feb 2021 16:31:47 -0600 Subject: [PATCH] power: fix bound on state array Attempts to disable PM_STATE_SOFT_OFF would index past the end of the count array. Increase the array length to allow operations on PM_STATE_SOFT_OFF. Signed-off-by: Peter Bigot --- subsys/power/pm_ctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/power/pm_ctrl.c b/subsys/power/pm_ctrl.c index 3467334a6c7..8ee64176377 100644 --- a/subsys/power/pm_ctrl.c +++ b/subsys/power/pm_ctrl.c @@ -15,7 +15,7 @@ #include LOG_MODULE_DECLARE(power); -#define PM_STATES_LEN (PM_STATE_SOFT_OFF - PM_STATE_ACTIVE) +#define PM_STATES_LEN (1 + PM_STATE_SOFT_OFF - PM_STATE_ACTIVE) static atomic_t power_state_disable_count[PM_STATES_LEN];