In our project, ASSERT is defined:
#define ASSERT(condition, severity) bsp_assert(condition, severity)
Then in bsp_assert:
void bsp_assert(uint8_t condition, uint8_t severity)
{
if(severity == SEVERITY_HIGH)
{
ll_sys_assert(condition);
}
}
When we run Coverity analysis with agression High, we got thousands of errors related to this assert, like this:
2. var_compare_op Comparing ptr_chnl_clsfction to null implies that ptr_chnl_clsfction might be null.
ASSERT(NULL != ptr_chnl_clsfction , SEVERITY_HIGH);
CID 442026: (#1 of 1): Dereference after null check (FORWARD_NULL)
5. var_deref_op Dereferencing null pointer ptr_chnl_clsfction.
ptr_chnl_clsfction[byte_iter] = 0x00;
I tried to comment bsp_assert, like this:
#define ASSERT(condition, severity) /*We don't use assert*/
Now I don't have any more the issue, but I guess it's not the purpose of assert.
How can I get rid of this issue ?
Thanks.
THis is how
FORWARD_NULLis reported in Coveritys:If
ptr_chnl_clsfctionis NULLDereferencing will result in crash