[HUST CSE]NULL POINTER (#7220)

* avoids the risk of a null pointer

* 将||改成&&来判断断言
There is a possibility of a null pointer

* there is a possibility of a null pointer

* Update components/drivers/fdt/src/dtb_get.c

Co-authored-by: Man, Jianting (Meco) <920369182@qq.com>

* 已根据代码规范进行修改,谢谢提醒

---------

Co-authored-by: Man, Jianting (Meco) <920369182@qq.com>
This commit is contained in:
Hy 2023-04-17 08:12:27 +08:00 committed by GitHub
parent 60835af8e1
commit 7c629d974d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -52,7 +52,7 @@ cy_rslt_t cyhal_crc_init(cyhal_crc_t *obj)
void cyhal_crc_free(cyhal_crc_t *obj)
{
CY_ASSERT(NULL != obj&&obj->resource.type != CYHAL_RSC_CRYPTO);
CY_ASSERT(NULL != obj && obj->resource.type != CYHAL_RSC_CRYPTO);
_cyhal_crc_calc_free(obj->base);
if (obj->resource.type != CYHAL_RSC_INVALID)
{

View File

@ -724,6 +724,7 @@ struct dtb_memreserve *dtb_node_get_dtb_memreserve(struct dtb_node *dtb_node, in
}
dtb_node_root = dtb_node_root->parent;
}
if(dtb_node_root == NULL) return NULL;
*memreserve_size = dtb_node_root->header->memreserve_sz;