From a08e930e20e7903bd01158315ac627f08910e947 Mon Sep 17 00:00:00 2001 From: I-Hsien Date: Fri, 14 Apr 2023 08:03:54 +0800 Subject: [PATCH] [HUST CSE] Fix nullptr issue in bsp/rv32m1_vega/ri5cy/board/fsl_host.c (#7236) During the process of statically checking the source code, it was found that this judgment directly obtained the member of the structure pointer without performing a null pointer check. When an upstream function has an exception and passes in a null pointer, a runtime error will occur. --- bsp/rv32m1_vega/ri5cy/board/fsl_host.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsp/rv32m1_vega/ri5cy/board/fsl_host.c b/bsp/rv32m1_vega/ri5cy/board/fsl_host.c index 8d64cf2ab5..f9a1f786a8 100644 --- a/bsp/rv32m1_vega/ri5cy/board/fsl_host.c +++ b/bsp/rv32m1_vega/ri5cy/board/fsl_host.c @@ -51,7 +51,7 @@ static status_t USDHC_TransferFunction(USDHC_Type *base, usdhc_transfer_t *conte usdhc_adma_config_t dmaConfig; - if (content->data != NULL) + if (content != NULL && content->data != NULL) { memset(&dmaConfig, 0, sizeof(usdhc_adma_config_t)); /* config adma */