From 47fe4c4fe22fa7df5e79867eb6a52e842e6abdb6 Mon Sep 17 00:00:00 2001 From: Heyi Guo Date: Mon, 25 Jan 2021 21:45:47 +0800 Subject: [PATCH] plat/arm/arm_image_load: fix bug of overriding the last node The traverse flow in function plat_add_sp_images_load_info() will find the last node in the main load info list, with its next_load_info==NULL. However this node is still useful and should not be overridden with SP node info. The bug will cause below error on RDN2 for spmd enabled: ERROR: Invalid NT_FW_CONFIG DTB passed Fix the bug by only setting the next_load_info of the last node in the original main node list. Signed-off-by: Heyi Guo Change-Id: Icaee5da1f2d53b29fdd6085a8cc507446186fd57 --- plat/arm/common/arm_image_load.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/plat/arm/common/arm_image_load.c b/plat/arm/common/arm_image_load.c index ed7f1f5a5..11cb3b839 100644 --- a/plat/arm/common/arm_image_load.c +++ b/plat/arm/common/arm_image_load.c @@ -51,10 +51,15 @@ static void plat_add_sp_images_load_info(struct bl_load_info *load_info) node_info = node_info->next_load_info; } while (node_info->next_load_info != NULL); + bl_load_info_node_t *sp_node = + &sp_mem_params_descs[index].load_node_mem; + + node_info->next_load_info = sp_node; + for (; index < MAX_SP_IDS; index++) { /* Populate the image information */ - node_info->image_id = sp_mem_params_descs[index].image_id; - node_info->image_info = &sp_mem_params_descs[index].image_info; + sp_node->image_id = sp_mem_params_descs[index].image_id; + sp_node->image_info = &sp_mem_params_descs[index].image_info; if ((index + 1U) == MAX_SP_IDS) { INFO("Reached Max number of SPs\n"); @@ -65,9 +70,9 @@ static void plat_add_sp_images_load_info(struct bl_load_info *load_info) return; } - node_info->next_load_info = + sp_node->next_load_info = &sp_mem_params_descs[index + 1U].load_node_mem; - node_info = node_info->next_load_info; + sp_node = sp_node->next_load_info; } }