[PATCH] net/mlx5: fix GCC uninitialized variable warning

Raslan Darawsheh rasland at nvidia.com
Sun Jan 9 12:58:59 CET 2022


Hi,

> -----Original Message-----
> From: Dmitry Kozlyuk <dkozlyuk at nvidia.com>
> Sent: Tuesday, December 28, 2021 11:17 AM
> To: dev at dpdk.org
> Cc: Li Zhang <lizh at nvidia.com>; stable at dpdk.org; Stephen Hemminger
> <stephen at networkplumber.org>; Matan Azrad <matan at nvidia.com>; Slava
> Ovsiienko <viacheslavo at nvidia.com>
> Subject: [PATCH] net/mlx5: fix GCC uninitialized variable warning
> 
> When building with -Db_sanitize=thread, GCC gives a warning:
> 
> drivers/net/mlx5/mlx5_flow_meter.c: In function
> ‘mlx5_flow_meter_create’:
> drivers/net/mlx5/mlx5_flow_meter.c:1170:33: warning: ‘legacy_fm’ may be
>     used uninitialized in this function [-Wmaybe-uninitialized]
> 
> This is a false-positive: legacy_fm is initialized and used if and only if priv->sh-
> >meter_aso_en is false.
> Work around this by initializing legacy_fm to NULL.
> Add an assertion before legacy_fm use in case the logic changes.
> 
> Fixes: 444320186393 ("net/mlx5: support meter creation with policy")
> Cc: lizh at nvidia.com
> Cc: stable at dpdk.org
> 
> Reported-by: Stephen Hemminger <stephen at networkplumber.org>
> Signed-off-by: Dmitry Kozlyuk <dkozlyuk at nvidia.com>
> Acked-by: Matan Azrad <matan at nvidia.com>

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh


More information about the stable mailing list