patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: stable@dpdk.org, Dariusz Sosnowski <dsosnowski@nvidia.com>,
	Viacheslav Ovsiienko <viacheslavo@nvidia.com>,
	Bing Zhao <bingz@nvidia.com>, Ori Kam <orika@nvidia.com>,
	Suanming Mou <suanmingm@nvidia.com>,
	Matan Azrad <matan@nvidia.com>, Ophir Munk <ophirmu@nvidia.com>
Subject: Re: [PATCH] net/mlx5: fix uninitialized warning
Date: Thu, 13 Nov 2025 09:50:49 -0800	[thread overview]
Message-ID: <20251113095049.008bbf9b@phoenix> (raw)
In-Reply-To: <20251113163301.285550-1-stephen@networkplumber.org>

On Thu, 13 Nov 2025 08:33:01 -0800
Stephen Hemminger <stephen@networkplumber.org> 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 unintialized
> stack value. Resolve by intializing to zero.
> 
> Fixes: 1256805dd54d ("net/mlx5: move Linux-specific functions")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---

The build fails with clang because of the (annoying) use of pedantic in this driver.
I will let mlx5 maintainers fix it then.

../drivers/net/mlx5/linux/mlx5_ethdev_os.c:515:33: error: use of GNU empty initializer extension [-Werror,-Wgnu-empty-initializer]
        struct rte_eth_link dev_link = { };

      reply	other threads:[~2025-11-13 17:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-13 16:33 Stephen Hemminger
2025-11-13 17:50 ` Stephen Hemminger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251113095049.008bbf9b@phoenix \
    --to=stephen@networkplumber.org \
    --cc=bingz@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=dsosnowski@nvidia.com \
    --cc=matan@nvidia.com \
    --cc=ophirmu@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=stable@dpdk.org \
    --cc=suanmingm@nvidia.com \
    --cc=viacheslavo@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).