fix(smccc): ensure that mpidr passed through SMC is valid

There are various SMC calls which pass mpidr as an argument which is
currently tested at random places in SMC call path.
To make the mpidr validation check consistent across SMC calls, do
this check as part of SMC argument validation.

This patch introduce a helper function is_valid_mpidr() to validate
mpidr and call it as part of validating SMC arguments at starting of
SMC handlers (which expect mpidr as an argument).

Signed-off-by: Manish Pandey <manish.pandey2@arm.com>
Change-Id: I11ea50e22caf17896cf4b2059b87029b2ba136b1
This commit is contained in:
Manish Pandey 2023-10-27 11:45:44 +01:00
parent 9bb15ab53a
commit e60c18471f
9 changed files with 46 additions and 45 deletions

View file

@ -61,15 +61,7 @@ int psci_cpu_on_start(u_register_t target_cpu,
{
int rc;
aff_info_state_t target_aff_state;
int ret = plat_core_pos_by_mpidr(target_cpu);
unsigned int target_idx;
/* Calling function must supply valid input arguments */
assert(ret >= 0);
assert((unsigned int)ret < PLATFORM_CORE_COUNT);
assert(ep != NULL);
target_idx = (unsigned int)ret;
unsigned int target_idx = (unsigned int)plat_core_pos_by_mpidr(target_cpu);
/*
* This function must only be called on platforms where the