core: mm: Fix idx truncation bug
When the idx of TA memory mapping is assigned, it is saved in the
l1_idx_t, which is the uint8_t or uint16_t type. But when it is
parsed, it is saved in uint8_t which can cause truncation.
To solve this problem, the idx should be saved in the l1_idx_t
type when parsing the idx.
Signed-off-by: leisen <leisen1@huawei.com>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
[jf: edit commit description]
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
diff --git a/core/arch/arm/mm/core_mmu_lpae.c b/core/arch/arm/mm/core_mmu_lpae.c
index ff1ac86..6a5db89 100644
--- a/core/arch/arm/mm/core_mmu_lpae.c
+++ b/core/arch/arm/mm/core_mmu_lpae.c
@@ -1138,7 +1138,7 @@
unsigned int base_idx)
{
#if (CORE_MMU_BASE_TABLE_LEVEL == 0)
- uint8_t idx = 0;
+ l1_idx_t idx = 0;
uint64_t *tbl = NULL;
#endif