From a42b426b8548e3304e995f1a49d2470d71072949 Mon Sep 17 00:00:00 2001 From: Manish V Badarkhe Date: Wed, 4 May 2022 17:21:22 +0100 Subject: [PATCH] fix(fvp): fix NULL pointer dereference issue Fixed below NULL pointer dereference issue reported by coverity scan by asserting the hw_config_info is not NULL. *** CID 378361: Null pointer dereferences (NULL_RETURNS) /plat/arm/board/fvp/fvp_bl2_setup.c: 84 in plat_get_next_bl_params() 78 79 /* To retrieve actual size of the HW_CONFIG */ 80 param_node = get_bl_mem_params_node(HW_CONFIG_ID); 81 assert(param_node != NULL); 82 83 /* Copy HW config from Secure address to NS address */ >>> CID 378361: Null pointer dereferences (NULL_RETURNS) >>> Dereferencing "hw_config_info", which is known to be "NULL". 84 memcpy((void *)hw_config_info->ns_config_addr, 85 (void *)hw_config_info->config_addr, 86 (size_t)param_node->image_info.image_size); Signed-off-by: Manish V Badarkhe Change-Id: Iaf584044cfc3b2583862bcc1be825966eaffd38e --- plat/arm/board/fvp/fvp_bl2_setup.c | 1 + 1 file changed, 1 insertion(+) diff --git a/plat/arm/board/fvp/fvp_bl2_setup.c b/plat/arm/board/fvp/fvp_bl2_setup.c index 4eee522b2..74e5d72f7 100644 --- a/plat/arm/board/fvp/fvp_bl2_setup.c +++ b/plat/arm/board/fvp/fvp_bl2_setup.c @@ -75,6 +75,7 @@ struct bl_params *plat_get_next_bl_params(void) /* grab NS HW config address */ hw_config_info = FCONF_GET_PROPERTY(dyn_cfg, dtb, HW_CONFIG_ID); + assert(hw_config_info != NULL); /* To retrieve actual size of the HW_CONFIG */ param_node = get_bl_mem_params_node(HW_CONFIG_ID);