plat/arm: css: Sanitize the input to css_validate_power_state
In the case of the platform max power level being less than the system power level, make sure to not overrun the array of power states. This fixes Coverity Scan OVERRUN defect CID 267021. Change-Id: I52646ab9be2fceeb5c331b5dad7a6267991f4197 Signed-off-by: Nariman Poushin <nariman.poushin@linaro.org>
This commit is contained in:
parent
9b4c611c4b
commit
8e26307db6
|
@ -263,12 +263,24 @@ static int css_validate_power_state(unsigned int power_state,
|
||||||
int rc;
|
int rc;
|
||||||
rc = arm_validate_power_state(power_state, req_state);
|
rc = arm_validate_power_state(power_state, req_state);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Ensure that we don't overrun the pwr_domain_state array in the case
|
||||||
|
* where the platform supported max power level is less than the system
|
||||||
|
* power level
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if (PLAT_MAX_PWR_LVL == CSS_SYSTEM_PWR_DMN_LVL)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ensure that the system power domain level is never suspended
|
* Ensure that the system power domain level is never suspended
|
||||||
* via PSCI CPU SUSPEND API. Currently system suspend is only
|
* via PSCI CPU SUSPEND API. Currently system suspend is only
|
||||||
* supported via PSCI SYSTEM SUSPEND API.
|
* supported via PSCI SYSTEM SUSPEND API.
|
||||||
*/
|
*/
|
||||||
req_state->pwr_domain_state[CSS_SYSTEM_PWR_DMN_LVL] = ARM_LOCAL_STATE_RUN;
|
|
||||||
|
req_state->pwr_domain_state[CSS_SYSTEM_PWR_DMN_LVL] =
|
||||||
|
ARM_LOCAL_STATE_RUN;
|
||||||
|
#endif
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue