Skip to content

Commit

Permalink
net/softnic: fix maybe-uninitialized warning
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
kevintraynor committed Sep 17, 2024
1 parent 6808180 commit 617f946
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/net/softnic/rte_eth_softnic_meter.c
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,7 @@ pmd_mtr_stats_read(struct rte_eth_dev *dev,
struct rte_mtr_stats s;
uint64_t s_mask = 0;

memset(&s, 0, sizeof(s));
mtr_stats_convert(p,
m,
&counters.stats[0],
Expand Down

0 comments on commit 617f946

Please sign in to comment.