diff mbox series

[net] net/mlx5e: Fix uninitialised struct field moder.comps

Message ID 1618834662-20292-1-git-send-email-wangyunjian@huawei.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net] net/mlx5e: Fix uninitialised struct field moder.comps | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net
netdev/subject_prefix success Link
netdev/cc_maintainers fail 2 blamed authors not CCed: yaminf@mellanox.com maxg@mellanox.com; 4 maintainers not CCed: yaminf@mellanox.com maxg@mellanox.com linux-rdma@vger.kernel.org leon@kernel.org
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

wangyunjian April 19, 2021, 12:17 p.m. UTC
From: Yunjian Wang <wangyunjian@huawei.com>

The 'comps' struct field in 'moder' is not being initialized
in mlx5e_get_def_rx_moderation(). So initialize 'moder' to
zero to avoid the issue.

Addresses-Coverity: ("Uninitialized scalar variable")
Fixes: 398c2b05bbee ("linux/dim: Add completions count to dim_sample")
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Saeed Mahameed April 20, 2021, 2:40 a.m. UTC | #1
On Mon, 2021-04-19 at 20:17 +0800, wangyunjian wrote:
> From: Yunjian Wang <wangyunjian@huawei.com>
> 
> The 'comps' struct field in 'moder' is not being initialized
> in mlx5e_get_def_rx_moderation(). So initialize 'moder' to
> zero to avoid the issue.
> 
> Addresses-Coverity: ("Uninitialized scalar variable")
> Fixes: 398c2b05bbee ("linux/dim: Add completions count to
> dim_sample")

net_dim doesn't use the comp value so there is no actual bug here.
Can you please drop the Fixes line and resubmit resubmit this to net-
next ... 



> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> index 5db63b9f3b70..9bcedfb0adfa 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> @@ -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)
>  {

also mlx5e_get_def_tx_moderation needs fixing.

Thanks for the patch, 

Saeed.

> -       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;
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 5db63b9f3b70..9bcedfb0adfa 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -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;