netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Zhu Yanjun <zyjzyj2000@gmail.com>, wangyunjian <wangyunjian@huawei.com>
Cc: Jakub Kicinski <kuba@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	saeedm@nvidia.com, netdev <netdev@vger.kernel.org>,
	dingxiaoxiong@huawei.com
Subject: Re: [PATCH net-next v2] net/mlx5e: Fix uninitialised struct field moder.comps
Date: Tue, 20 Apr 2021 12:21:12 +0300	[thread overview]
Message-ID: <YH6dCCh5vgWcnzc+@unreal> (raw)
In-Reply-To: <CAD=hENfAZZBm3iipTAv6q9u12z8WmT7LUgXSDFEdtSf_k9_Lcw@mail.gmail.com>

On Tue, Apr 20, 2021 at 03:09:03PM +0800, Zhu Yanjun wrote:
> On Tue, Apr 20, 2021 at 3:01 PM wangyunjian <wangyunjian@huawei.com> wrote:
> >
> > From: Yunjian Wang <wangyunjian@huawei.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.

Please state that it is false alarm and this patch doesn't fix anything
except broken static analyzer tool.

> >
> > Addresses-Coverity: ("Uninitialized scalar variable")
> > Signed-off-by: Yunjian Wang <wangyunjian@huawei.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 = {};
> 
> If I remember correctly, some gcc compiler will report errors about this "{}".

Kernel doesn't support such compilers.

Thanks

  reply	other threads:[~2021-04-20  9:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-20  7:00 [PATCH net-next v2] net/mlx5e: Fix uninitialised struct field moder.comps wangyunjian
2021-04-20  7:09 ` Zhu Yanjun
2021-04-20  9:21   ` Leon Romanovsky [this message]
2021-04-20  9:28     ` Zhu Yanjun
2021-04-20 11:05       ` Leon Romanovsky
2021-05-04  7:27 ` Leon Romanovsky

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=YH6dCCh5vgWcnzc+@unreal \
    --to=leon@kernel.org \
    --cc=davem@davemloft.net \
    --cc=dingxiaoxiong@huawei.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@nvidia.com \
    --cc=wangyunjian@huawei.com \
    --cc=zyjzyj2000@gmail.com \
    /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).