[PATCH v2] net/mlx5: fix warning from uninitialized variable
Raslan Darawsheh
rasland at nvidia.com
Tue Nov 18 12:18:48 CET 2025
Hi,
On 14/11/2025 7:49 PM, Stephen Hemminger wrote:
> Gcc-16 detects use of uninitialized variable.
> ./drivers/net/mlx5/linux/mlx5_ethdev_os.c: In function ‘mlx5_link_update’:
> ../drivers/net/mlx5/linux/mlx5_ethdev_os.c:539:15: warning: ‘*(long unsigned int *)((char *)&dev_link + offsetof(struct rte_eth_link, <U38c0>))’ may be used uninitialized [-Wmaybe-uninitialized]
> 539 | ret = !!memcmp(&dev->data->dev_link, &dev_link,
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 540 | sizeof(struct rte_eth_link));
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ../drivers/net/mlx5/linux/mlx5_ethdev_os.c:515:29: note: ‘*(long unsigned int *)((char *)&dev_link + offsetof(struct rte_eth_link, <U38c0>))’ was declared here
> 515 | struct rte_eth_link dev_link;
> |
>
> If the retry loop exits the code would do memcmp against uninitialized
> stack value. Resolve by initializing to zero.
>
> Bugzilla ID: 1823
>
> Fixes: 1256805dd54d ("net/mlx5: move Linux-specific functions")
> Fixes: cfee94752b8f ("net/mlx5: fix link status to use wait to complete")
> Cc: stable at dpdk.org
>
> Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
Acked-by: Raslan Darawsheh <rasland at nvidia.com>
Patch applied to next-net-mlx,
Kindest regards
Raslan Darawsheh
More information about the stable
mailing list