From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A6A3C433ED for ; Tue, 20 Apr 2021 11:05:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3D4A661363 for ; Tue, 20 Apr 2021 11:05:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231848AbhDTLFz (ORCPT ); Tue, 20 Apr 2021 07:05:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:42064 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231651AbhDTLFu (ORCPT ); Tue, 20 Apr 2021 07:05:50 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 19EDD6139A; Tue, 20 Apr 2021 11:05:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1618916718; bh=T1MBpxb+qMapIOur2MjwDyVFf1uMt6D9ZpaFBYNhquk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=nj1hAWCDtYByOjzcxpFnpt/zvvVfCRiSuwpebQTiZZKr4JbkO/0wJa8rkeHd2i/3W ifJ8JMheSOmGLH9Jh+GL8vROCfDMsWjcdtw9CyKbBCIy8PYy7/2zsa1U5nqq9GOWCR CmBrQ8Nh5It+ftBIDNG4DIXKySNzpsW+mmo7te8SFQqvm+2VQQ696HFD9KWhtCaf0D 0RUMc2ZM/tuEYLnhIFSFBDMB3MADr2qOk4FPPp24PEm3oW///Bp1WDYWpjJwlnuq8G UOIpyYthSHx/EHF1Cpocg2A96TZMiHK+6f7Wj+eDm5q9OR9VLg5pCCqQqrYNDZt9l5 5CJ45dXkrVMow== Date: Tue, 20 Apr 2021 14:05:14 +0300 From: Leon Romanovsky To: Zhu Yanjun Cc: wangyunjian , Jakub Kicinski , "David S. Miller" , saeedm@nvidia.com, netdev , dingxiaoxiong@huawei.com Subject: Re: [PATCH net-next v2] net/mlx5e: Fix uninitialised struct field moder.comps Message-ID: References: <1618902026-16588-1-git-send-email-wangyunjian@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tue, Apr 20, 2021 at 05:28:43PM +0800, Zhu Yanjun wrote: > On Tue, Apr 20, 2021 at 5:21 PM Leon Romanovsky wrote: > > > > On Tue, Apr 20, 2021 at 03:09:03PM +0800, Zhu Yanjun wrote: > > > On Tue, Apr 20, 2021 at 3:01 PM wangyunjian wrote: > > > > > > > > From: Yunjian Wang > > > > > > > > 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 > > > > --- > > > > 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. > > Are you sure? Why are you so confirmative? Yes, I'm sure. Please read this whole discussion, I hope that it will answer your question on why I'm so sure. https://lore.kernel.org/linux-rdma/20200730192026.110246-1-yepeilin.cs@gmail.com/ > > Zhu Yanjun > > > > > Thanks