From: Kevin Traynor <ktraynor@redhat.com>
To: stable@dpdk.org
Cc: alialnu@nvidia.com
Subject: Re: [PATCH 21.11] net/softnic: fix maybe-uninitialized warning
Date: Fri, 13 Sep 2024 10:05:38 +0100 [thread overview]
Message-ID: <9aaa3c82-fc68-4f98-a15e-5e991a3d5621@redhat.com> (raw)
In-Reply-To: <20240911141259.55514-1-ktraynor@redhat.com>
On 11/09/2024 15:12, Kevin Traynor wrote:
> In pmd_mtr_stats_read() 'struct rte_mtr_stats s' is initialized
> during the call to mtr_stats_convert() but on some systems it
> is triggering a compiler warning. e.g.
>
> drivers/net/softnic/rte_eth_softnic_meter.c:916:25: error: 's'
> may be used uninitialized [-Werror=maybe-uninitialized]
>
> Initialize the struct in pmd_mtr_stats_read() to avoid warnings.
>
> Reported-by: Ali Alnubani <alialnu@nvidia.com>
> Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
> ---
> drivers/net/softnic/rte_eth_softnic_meter.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/softnic/rte_eth_softnic_meter.c b/drivers/net/softnic/rte_eth_softnic_meter.c
> index 6b02f43e31..fea26f9c14 100644
> --- a/drivers/net/softnic/rte_eth_softnic_meter.c
> +++ b/drivers/net/softnic/rte_eth_softnic_meter.c
> @@ -904,5 +904,5 @@ pmd_mtr_stats_read(struct rte_eth_dev *dev,
> /* Stats format conversion. */
> if (stats || stats_mask) {
> - struct rte_mtr_stats s;
> + struct rte_mtr_stats s = {0};
Even though I checked in godbolt, this failed CI for rhel7 gcc 4.8.5
because of the added -Wall, so I will, change to "= {};", re-run CI and
apply with that change if all good.
> uint64_t s_mask = 0;
>
prev parent reply other threads:[~2024-09-13 9:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-11 14:12 Kevin Traynor
2024-09-13 9:05 ` Kevin Traynor [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=9aaa3c82-fc68-4f98-a15e-5e991a3d5621@redhat.com \
--to=ktraynor@redhat.com \
--cc=alialnu@nvidia.com \
--cc=stable@dpdk.org \
/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).