mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-05-04 01:48:39 +00:00
Fix: fixing coverity issue for SPM Core.
spmd_get_context_by_mpidr was using potentially negative value as an array index. plat_core_pos_by_mpidr could return -1 on failure which is utilized by some platforms. Signed-off-by: Max Shvetsov <maksims.svecovs@arm.com> Change-Id: I7f8827e77f18da389c9cafdc1fc841aba9f03120
This commit is contained in:
parent
a41ca4c344
commit
f7fb0bf77f
1 changed files with 8 additions and 1 deletions
|
@ -46,7 +46,14 @@ static entry_point_info_t *spmc_ep_info;
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
spmd_spm_core_context_t *spmd_get_context_by_mpidr(uint64_t mpidr)
|
spmd_spm_core_context_t *spmd_get_context_by_mpidr(uint64_t mpidr)
|
||||||
{
|
{
|
||||||
return &spm_core_context[plat_core_pos_by_mpidr(mpidr)];
|
int core_idx = plat_core_pos_by_mpidr(mpidr);
|
||||||
|
|
||||||
|
if (core_idx < 0) {
|
||||||
|
ERROR("Invalid mpidr: %llx, returned ID: %d\n", mpidr, core_idx);
|
||||||
|
panic();
|
||||||
|
}
|
||||||
|
|
||||||
|
return &spm_core_context[core_idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
|
Loading…
Add table
Reference in a new issue