mlx5e_psp_get_stats() reads the PSP flow counters into an uninitialized on-stack struct. mlx5e_accel_psp_fs_get_stats_fill() ignores the mlx5_fc_query() return value, and a failed query, e.g. -ENOLINK when the device is in internal error state, leaves the counter fields unset. The uninitialized stack values are then reported to user space through the PSP get-stats netlink command. Zero-initialize the struct, so the counters of a failed query read 0. Fixes: b1346219e535 ("net/mlx5e: Add PSP stats support for Rx/Tx flows") Signed-off-by: Tariq Toukan Reviewed-by: Cosmin Ratiu --- drivers/net/ethernet/mellanox/mlx5/core/en_accel/psp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/psp.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/psp.c index 73b232379263..4aacb4173b1b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/psp.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/psp.c @@ -995,7 +995,7 @@ static void mlx5e_psp_get_stats(struct psp_dev *psd, struct psp_dev_stats *stats) { struct mlx5e_priv *priv = netdev_priv(psd->main_netdev); - struct mlx5e_psp_stats nstats; + struct mlx5e_psp_stats nstats = {}; mlx5e_accel_psp_fs_get_stats_fill(priv, &nstats); stats->rx_packets = nstats.psp_rx_pkts; base-commit: e1055cbfd6eb578417f3ce983cf44462e8465267 -- 2.44.0