Coverity fix: Remove GGC ignore -Warray-bounds
GCC diagnostics were added to ignore array boundaries, instead of ignoring GCC warning current code will check for array boundaries and perform and array update only for valid elements. Resolves: `CID 246574` `CID 246710` `CID 246651` Signed-off-by: Deepika Bhavnani <deepika.bhavnani@arm.com> Change-Id: I7530ecf7a1707351c6ee87e90cc3d33574088f57
This commit is contained in:
parent
d1b6013d84
commit
41af05154a
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
|
* Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -198,21 +198,17 @@ static unsigned int get_power_on_target_pwrlvl(void)
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Helper function to update the requested local power state array. This array
|
* Helper function to update the requested local power state array. This array
|
||||||
* does not store the requested state for the CPU power level. Hence an
|
* does not store the requested state for the CPU power level. Hence an
|
||||||
* assertion is added to prevent us from accessing the wrong index.
|
* assertion is added to prevent us from accessing the CPU power level.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
static void psci_set_req_local_pwr_state(unsigned int pwrlvl,
|
static void psci_set_req_local_pwr_state(unsigned int pwrlvl,
|
||||||
unsigned int cpu_idx,
|
unsigned int cpu_idx,
|
||||||
plat_local_state_t req_pwr_state)
|
plat_local_state_t req_pwr_state)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
* This should never happen, we have this here to avoid
|
|
||||||
* "array subscript is above array bounds" errors in GCC.
|
|
||||||
*/
|
|
||||||
assert(pwrlvl > PSCI_CPU_PWR_LVL);
|
assert(pwrlvl > PSCI_CPU_PWR_LVL);
|
||||||
#pragma GCC diagnostic push
|
if ((pwrlvl > PSCI_CPU_PWR_LVL) && (pwrlvl <= PLAT_MAX_PWR_LVL) &&
|
||||||
#pragma GCC diagnostic ignored "-Warray-bounds"
|
(cpu_idx < PLATFORM_CORE_COUNT)) {
|
||||||
psci_req_local_pwr_states[pwrlvl - 1U][cpu_idx] = req_pwr_state;
|
psci_req_local_pwr_states[pwrlvl - 1U][cpu_idx] = req_pwr_state;
|
||||||
#pragma GCC diagnostic pop
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
|
@ -245,7 +241,11 @@ static plat_local_state_t *psci_get_req_local_pwr_states(unsigned int pwrlvl,
|
||||||
{
|
{
|
||||||
assert(pwrlvl > PSCI_CPU_PWR_LVL);
|
assert(pwrlvl > PSCI_CPU_PWR_LVL);
|
||||||
|
|
||||||
|
if ((pwrlvl > PSCI_CPU_PWR_LVL) && (pwrlvl <= PLAT_MAX_PWR_LVL) &&
|
||||||
|
(cpu_idx < PLATFORM_CORE_COUNT)) {
|
||||||
return &psci_req_local_pwr_states[pwrlvl - 1U][cpu_idx];
|
return &psci_req_local_pwr_states[pwrlvl - 1U][cpu_idx];
|
||||||
|
} else
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue