[dpdk-dev] [PATCH v3] app/testpmd: fix passing negative parameter to strerror

Ferruh Yigit ferruh.yigit at intel.com
Mon Jun 8 16:47:53 CEST 2020


On 6/6/2020 4:46 AM, Wei Hu (Xavier) wrote:
> Currently, there are coverity defect warnings those were found from the
> public coverity.
> https://scan.coverity.com/projects/dpdk-data-plane-development-kit
> 
> Coverity issue:
>   In nic_stats_clear function:
>     CID 358450 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS)
>     5. negative_returns: ret is passed to a parameter that cannot be
>        negative.
> 
>     CID 358449 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS)
>     6. negative_returns: ret is passed to a parameter that cannot be
>        negative.
> 
>   In nic_xstats_clear function:
>     CID 358437 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS)
>     6. negative_returns: ret is passed to a parameter that cannot be
>        negative.
> 
>     CID 349913 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS)
>     5. negative_returns: ret is passed to a parameter that cannot be
>        negative.


Shortened above as following:
    Coverity issue: 349913, 358437, 358449, 358450

> 
> This patch fixes them by passing '-ret' to the function strerror() when ret
> is negative.
> 
> Fixes: da328f7f115a ("ethdev: change xstats reset function to return int")
> Fixes: 9eb974221f44 ("app/testpmd: fix statistics after reset")
> Cc: stable at dpdk.org
> 
> Signed-off-by: Wei Hu (Xavier) <xavier.huwei at huawei.com>

Reviewed-by: Ferruh Yigit <ferruh.yigit at intel.com>

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

> ---
> v2 -> v3:
> 	1. replace the coverity warning infromation with the ones found
> 	   from the public coverity in the commit log.

Thanks.



More information about the dev mailing list