Page MenuHomePhabricator

fix broken off-by-one checks in imx8 plat_core_pos_by_mpidr()
Open, Needs TriagePublic

Description

The in plat/imx/common/imx8_topology.c plat_core_pos_by_mpidr() do are greater-than instead of a greater-or-equal compare on the cluster_id and cpu_id.

if (cluster_id > PLATFORM_CLUSTER_COUNT ||
    cpu_id > PLATFORM_MAX_CPU_PER_CLUSTER)
    return -1;

should instead be:

if (cluster_id >= PLATFORM_CLUSTER_COUNT ||
    cpu_id >= PLATFORM_MAX_CPU_PER_CLUSTER)
    return -1;