diff options
author | Soby Mathew <soby.mathew@arm.com> | 2016-02-02 14:23:10 +0000 |
---|---|---|
committer | Soby Mathew <soby.mathew@arm.com> | 2016-02-08 10:25:55 +0000 |
commit | 6d18969f59a832deaf0989f32f33ba49f22b8e32 (patch) | |
tree | 15e8b283d7d8e904bbbd0030e8be6f4edcf675f3 /services | |
parent | dbc807179fea7438efa3374584310727ce44bbc9 (diff) |
PSCI: Resolve GCC static analysis false positive
When BL31 is compiled at `-O3` optimization level using Linaro GCC 4.9
AArch64 toolchain, it reports the following error:
```
services/std_svc/psci/psci_common.c: In function 'psci_do_state_coordination':
services/std_svc/psci/psci_common.c:220:27: error: array subscript is above
array bounds [-Werror=array-bounds]
psci_req_local_pwr_states[pwrlvl - 1][cpu_idx] = req_pwr_state;
^
```
This error is a false positive and this patch resolves the error by asserting
the array bounds in `psci_do_state_coordination()`.
Fixes ARM-software/tf-issues#347
Change-Id: I3584ed7b2e28faf455b082cb3281d6e1d11d6495
Diffstat (limited to 'services')
-rw-r--r-- | services/std_svc/psci/psci_common.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/services/std_svc/psci/psci_common.c b/services/std_svc/psci/psci_common.c index 465c5fd9..8a2b81c3 100644 --- a/services/std_svc/psci/psci_common.c +++ b/services/std_svc/psci/psci_common.c @@ -393,6 +393,7 @@ void psci_do_state_coordination(unsigned int end_pwrlvl, unsigned int start_idx, ncpus; plat_local_state_t target_state, *req_states; + assert(end_pwrlvl <= PLAT_MAX_PWR_LVL); parent_idx = psci_cpu_pd_nodes[cpu_idx].parent_node; /* For level 0, the requested state will be equivalent |