[PATCH] app/testpmd: remove useless pointer checks

Ferruh Yigit ferruh.yigit at amd.com
Fri May 20 17:04:45 CEST 2022


On 5/12/2022 8:19 AM, David Marchand wrote:
> On Tue, Mar 29, 2022 at 11:26 AM Thomas Monjalon <thomas at monjalon.net> wrote:
>>
>> 24/03/2022 17:15, David Marchand:
>>> Parameters to this static helper can't be NULL.
>>> str has already been dereferenced in caller.
>>> dst and size point to variable in stack.
>>
>> The same function is copy/pasted in several places.
>> Why simplifying only this one? because of its static nature?
>>
>> Shouldn't we make it a common function as other string helpers?
> 
> Sorry, this thread fell through the cracks.
> 
> The issue was raised by covscan:
> 
> Error: REVERSE_INULL (CWE-476):
> dpdk-21.11/app/test-pmd/cmdline_flow.c:7705: deref_ptr: Directly
> dereferencing pointer "size".
> dpdk-21.11/app/test-pmd/cmdline_flow.c:7711: check_after_deref:
> Null-checking "size" suggests that it may be null, but it has already
> been dereferenced on all paths leading to the check.
> # 7709|       if ((src == NULL) ||
> # 7710|           (dst == NULL) ||
> # 7711|->         (size == NULL) ||
> # 7712|           (*size == 0))
> # 7713|           return -1;
> 
> 
> As for the rest of the code, there might be more cleanups to do, as followups.
> 

Proceeding with this one as it solves coverity issue,

Applied to dpdk-next-net/main, thanks.


More information about the stable mailing list