[dpdk-dev] cppcheck on dpdk

Adrien Mazarguil adrien.mazarguil at 6wind.com
Wed May 16 18:03:08 CEST 2018


On Wed, May 16, 2018 at 01:41:09PM +0100, Ferruh Yigit wrote:
> Today after listening Colin's Static Analysis talk, I run cppcheck on v18.05-rc4
> code and it revealed some issues, sharing here for anyone to interested in
> fixing them. At least I encourage to check maintainers to check their own pieces.
> 
> It is really easy to run cppcheck, in dpdk source folder:
> cppcheck --force .
> 
> With above command cppcheck verifies all #ifdef paths, some issues below seems
> related to this and that is why these issues not seen in build tests.
<snip>
> [drivers/net/mlx4/mlx4_flow.c:303]: (warning) Possible null pointer dereference:
> mask

False positive, a NULL mask means flow->promisc == 1, in which case this
code isn't reached.

> [drivers/net/mlx4/mlx4_rxtx.c:266]: (error) Shifting signed 32-bit value by 31
> bits is undefined behaviour
> [drivers/net/mlx4/mlx4_rxtx.c:624]: (error) Shifting signed 32-bit value by 31
> bits is undefined behaviour
> [drivers/net/mlx4/mlx4_txq.c:89]: (error) Shifting signed 32-bit value by 31
> bits is undefined behaviour
> [drivers/net/mlx4/mlx4_txq.c:91]: (error) Shifting signed 32-bit value by 31
> bits is undefined behaviour

Indeed, I'll send fixes shortly for these. Thanks!

-- 
Adrien Mazarguil
6WIND


More information about the dev mailing list