Browse Source

fix(spmd): coverity scan issues

Coverity defects fixed by this patch are:
*** CID 400208:  Performance inefficiencies  (PASS_BY_VALUE)
/include/services/el3_spmd_logical_sp.h: 108 in
ffa_partition_info_regs_get_last_idx()

*** CID 400207:  Performance inefficiencies  (PASS_BY_VALUE)
/services/std_svc/spmd/spmd_logical_sp.c: 359 in
ffa_partition_info_regs_get_part_info()

Signed-off-by: Raghu Krishnamurthy <raghu.ncstate@gmail.com>
Change-Id: I9597377a8ec3d5519995e1619d99ee7102f33939
pull/2003/head
Raghu Krishnamurthy 1 year ago
parent
commit
b04343f3c9
  1. 18
      include/services/el3_spmd_logical_sp.h
  2. 4
      plat/arm/board/fvp/fvp_spmd_logical_sp.c
  3. 4
      services/std_svc/spmd/spmd_logical_sp.c

18
include/services/el3_spmd_logical_sp.h

@ -105,33 +105,33 @@ static inline bool is_ffa_direct_msg_resp(struct ffa_value *retval)
}
static inline uint16_t ffa_partition_info_regs_get_last_idx(
struct ffa_value args)
struct ffa_value *args)
{
return (uint16_t)(args.arg2 & 0xFFFFU);
return (uint16_t)(args->arg2 & 0xFFFFU);
}
static inline uint16_t ffa_partition_info_regs_get_curr_idx(
struct ffa_value args)
struct ffa_value *args)
{
return (uint16_t)((args.arg2 >> 16) & 0xFFFFU);
return (uint16_t)((args->arg2 >> 16) & 0xFFFFU);
}
static inline uint16_t ffa_partition_info_regs_get_tag(struct ffa_value args)
static inline uint16_t ffa_partition_info_regs_get_tag(struct ffa_value *args)
{
return (uint16_t)((args.arg2 >> 32) & 0xFFFFU);
return (uint16_t)((args->arg2 >> 32) & 0xFFFFU);
}
static inline uint16_t ffa_partition_info_regs_get_desc_size(
struct ffa_value args)
struct ffa_value *args)
{
return (uint16_t)(args.arg2 >> 48);
return (uint16_t)(args->arg2 >> 48);
}
uint64_t spmd_el3_populate_logical_partition_info(void *handle, uint64_t x1,
uint64_t x2, uint64_t x3);
bool ffa_partition_info_regs_get_part_info(
struct ffa_value args, uint8_t idx,
struct ffa_value *args, uint8_t idx,
struct ffa_partition_info_v1_1 *partition_info);
bool spmd_el3_invoke_partition_info_get(

4
plat/arm/board/fvp/fvp_spmd_logical_sp.c

@ -32,7 +32,7 @@ static void fvp_get_partition_info(void)
panic();
}
num_partitions = ffa_partition_info_regs_get_last_idx(ret) + 1;
num_partitions = ffa_partition_info_regs_get_last_idx(&ret) + 1;
if (num_partitions > SPMD_LP_MAX_SUPPORTED_SP) {
panic();
}
@ -41,7 +41,7 @@ static void fvp_get_partition_info(void)
for (uint16_t i = 0; i < num_partitions; i++) {
INFO("***Start Partition***\n");
if (!ffa_partition_info_regs_get_part_info(ret, i, &part_info[i]))
if (!ffa_partition_info_regs_get_part_info(&ret, i, &part_info[i]))
panic();
INFO("\tPartition ID: 0x%x\n", part_info[i].ep_id);
INFO("\tvCPU count:0x%x\n", part_info[i].execution_ctx_count);

4
services/std_svc/spmd/spmd_logical_sp.c

@ -356,7 +356,7 @@ void spmd_logical_sp_set_spmc_failure(void)
* other code to consume.
*/
bool ffa_partition_info_regs_get_part_info(
struct ffa_value args, uint8_t idx,
struct ffa_value *args, uint8_t idx,
struct ffa_partition_info_v1_1 *partition_info)
{
uint64_t *arg_ptrs;
@ -375,7 +375,7 @@ bool ffa_partition_info_regs_get_part_info(
* function, arg1 is reserved, arg2 encodes indices. arg3 and greater
* values reflect partition properties.
*/
arg_ptrs = (uint64_t *)&args + ((idx * 3) + 3);
arg_ptrs = (uint64_t *)args + ((idx * 3) + 3);
info = *arg_ptrs;
arg_ptrs++;

Loading…
Cancel
Save