[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1618902026-16588-1-git-send-email-wangyunjian@huawei.com>
Date: Tue, 20 Apr 2021 15:00:26 +0800
From: wangyunjian <wangyunjian@...wei.com>
To: <kuba@...nel.org>, <davem@...emloft.net>
CC: <saeedm@...dia.com>, <netdev@...r.kernel.org>,
<dingxiaoxiong@...wei.com>, Yunjian Wang <wangyunjian@...wei.com>
Subject: [PATCH net-next v2] net/mlx5e: Fix uninitialised struct field moder.comps
From: Yunjian Wang <wangyunjian@...wei.com>
The 'comps' struct field in 'moder' is not being initialized in
mlx5e_get_def_rx_moderation() and mlx5e_get_def_tx_moderation().
So initialize 'moder' to zero to avoid the issue.
Addresses-Coverity: ("Uninitialized scalar variable")
Signed-off-by: Yunjian Wang <wangyunjian@...wei.com>
---
v2: update mlx5e_get_def_tx_moderation() also needs fixing
---
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 5db63b9f3b70..17a817b7e539 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -4868,7 +4868,7 @@ static bool slow_pci_heuristic(struct mlx5_core_dev *mdev)
static struct dim_cq_moder mlx5e_get_def_tx_moderation(u8 cq_period_mode)
{
- struct dim_cq_moder moder;
+ struct dim_cq_moder moder = {};
moder.cq_period_mode = cq_period_mode;
moder.pkts = MLX5E_PARAMS_DEFAULT_TX_CQ_MODERATION_PKTS;
@@ -4881,7 +4881,7 @@ static struct dim_cq_moder mlx5e_get_def_tx_moderation(u8 cq_period_mode)
static struct dim_cq_moder mlx5e_get_def_rx_moderation(u8 cq_period_mode)
{
- struct dim_cq_moder moder;
+ struct dim_cq_moder moder = {};
moder.cq_period_mode = cq_period_mode;
moder.pkts = MLX5E_PARAMS_DEFAULT_RX_CQ_MODERATION_PKTS;
--
2.23.0
Powered by blists - more mailing lists