Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp288332rdh; Thu, 26 Oct 2023 02:07:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG2CheCgTIoTeUqZDDuFgyUsmlVUBAKwGqPk/OInU5MlvAhLqwUwYcJIya30+qLoB+1ZGM2 X-Received: by 2002:a05:6122:a03:b0:49a:c339:11b9 with SMTP id 3-20020a0561220a0300b0049ac33911b9mr18271540vkn.11.1698311232870; Thu, 26 Oct 2023 02:07:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698311232; cv=none; d=google.com; s=arc-20160816; b=TQBDTzvfrARRVezJWX77F/6b6CrWyoWJBIBWFu1duGL1ShG1qcJ9kHpQTaHH8RlZHx b3zd1e0qVzm3tS7oT3WjwO+cALB7k2Slf3CNJW89nDNlg5NvM9mG5bT4WFAFS4qtql02 J/FQy7gaSNkqU/QcpIP2iuxrkMHWBAzCWXezqIlFXl7LZ4PiQyptG7P4ailxVvAn+JzQ YYT2WU5AfnU3nph5XPiwKaFVKTWANLjmGxRl+IgRH3YD6qPT481STVCjvz7536c3scud /Zx1Z1JUWvDXHD67ybPzKV9w8lJEMQER2GjDyByELehPGFi6p0gUQzQ6vKkDKppDD44g nGUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=TT9ugNmJvgMGrGUN0fNDaubQF0t3tJlkRXLFRObOGJM=; fh=mkdvyylbyOxZ8OaMP7Q1jDUzfn81kaiDqMdd1blveBI=; b=Z49WS21h2jtDBQ/RtBy+NflpmlSNw/WhbDZoyJYSQm9dFfSHR1czGyC+2z0t27C6aZ AvgOI/eidttqTT3Sabr0UTAvvo0P6pq+lcQB5dLXzjaBnGzs2nJO0XfvP+U6UYcoBYcb 9j2IAKVYpD57a/bcyyRIb4p3zaq1n38pgCmnS+/9pOJyutXAPZqFSGT9SabSIP4M0+5I Z5c5YqkDXBG07lwPhKLqbXp2OcPCKzxizpgGIQD3U6hFPItQsFa6yeRpe9CQrrEjPBH/ fZEOc1Wj4YSug+pmY8+ZblP2UmBzNfe9k6k/D9SATO3B+bJjt0jS535EFnmAuWZ62KMM HN6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=JQMTeaPD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id z185-20020a8165c2000000b005a7b1d9a1f8si13055170ywb.553.2023.10.26.02.07.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 02:07:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=JQMTeaPD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 775D88212A80; Thu, 26 Oct 2023 02:07:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229785AbjJZJHJ (ORCPT + 99 others); Thu, 26 Oct 2023 05:07:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229518AbjJZJHH (ORCPT ); Thu, 26 Oct 2023 05:07:07 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E19CB10E; Thu, 26 Oct 2023 02:07:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698311224; x=1729847224; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=tEXGA+hQXBm1ufjQHDtYW7uE1dK4Tg/P5ocdejt0Njw=; b=JQMTeaPDrHN4eo5X9RBBzHlXrmcI+mWM1/xlqz0qSwY1+HaNxdPQ+m/z flm3fNNbBt+wrLK6G24IN33K8iJFw6Ht04Dc6Rbl/IQ8C+qDqsQEOrEu8 GHrt2qPUGMRbIIXA+E4v4hlFWaV9wH47HyW2E2SpJRI06klajxjX9IWRM wmgPNR/wOql6MOYa3OoFNU8AEkLgDBF694aJY8ReD4/AUlYN7EzVGDVL7 ZbYOoG+rQ8qMr0mKAjUlfdIVsr48Ehyi6j03lnHshMTVU1TOiq6P0+dCq plB9B6BJpQWwezWwCW9CXBh8TGujfqsUnDaujvbkwBQqTZcjaOEbvxNz4 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10874"; a="451732079" X-IronPort-AV: E=Sophos;i="6.03,253,1694761200"; d="scan'208";a="451732079" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2023 02:06:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10874"; a="932662078" X-IronPort-AV: E=Sophos;i="6.03,253,1694761200"; d="scan'208";a="932662078" Received: from wasp.igk.intel.com (HELO wasp) ([10.102.20.192]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2023 02:06:54 -0700 Date: Thu, 26 Oct 2023 10:41:34 +0200 From: Michal Swiatkowski To: Przemek Kitszel Cc: netdev@vger.kernel.org, Saeed Mahameed , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jiri Pirko , linux-kernel@vger.kernel.org, Leon Romanovsky , Tariq Toukan , Danielle Ratson , Ido Schimmel , Petr Machata , Moshe Shemesh , Eran Ben Elisha , Aya Levin , Simon Horman , Dan Carpenter Subject: Re: [PATCH net-next] net/mlx5: fix uninit value use Message-ID: References: <20231025145050.36114-1-przemyslaw.kitszel@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231025145050.36114-1-przemyslaw.kitszel@intel.com> X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 26 Oct 2023 02:07:11 -0700 (PDT) On Wed, Oct 25, 2023 at 04:50:50PM +0200, Przemek Kitszel wrote: > Avoid use of uninitialized state variable. > > In case of mlx5e_tx_reporter_build_diagnose_output_sq_common() it's better > to still collect other data than bail out entirely. > > Reported-by: Dan Carpenter > Link: https://lore.kernel.org/netdev/8bd30131-c9f2-4075-a575-7fa2793a1760@moroto.mountain > Fixes: d17f98bf7cc9 ("net/mlx5: devlink health: use retained error fmsg API") > Signed-off-by: Przemek Kitszel > --- > drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c | 6 +++++- > drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c | 8 ++++++-- > 2 files changed, 11 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c > index fc5a9fdd06db..fea8c0a5fe89 100644 > --- a/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c > @@ -263,8 +263,12 @@ mlx5e_rx_reporter_build_diagnose_output_rq_common(struct mlx5e_rq *rq, > if (rq->icosq) { > struct mlx5e_icosq *icosq = rq->icosq; > u8 icosq_hw_state; > + int err; > + > + err = mlx5_core_query_sq_state(rq->mdev, icosq->sqn, &icosq_hw_state); > + if (err) > + return err; > > - mlx5_core_query_sq_state(rq->mdev, icosq->sqn, &icosq_hw_state); > mlx5e_reporter_icosq_diagnose(icosq, icosq_hw_state, fmsg); > } > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c > index ccff7c26d6ac..6b44ddce14e9 100644 > --- a/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c > @@ -221,12 +221,16 @@ mlx5e_tx_reporter_build_diagnose_output_sq_common(struct devlink_fmsg *fmsg, > bool stopped = netif_xmit_stopped(sq->txq); > struct mlx5e_priv *priv = sq->priv; > u8 state; > + int err; > > - mlx5_core_query_sq_state(priv->mdev, sq->sqn, &state); > devlink_fmsg_u32_pair_put(fmsg, "tc", tc); > devlink_fmsg_u32_pair_put(fmsg, "txq ix", sq->txq_ix); > devlink_fmsg_u32_pair_put(fmsg, "sqn", sq->sqn); > - devlink_fmsg_u8_pair_put(fmsg, "HW state", state); > + > + err = mlx5_core_query_sq_state(priv->mdev, sq->sqn, &state); > + if (!err) > + devlink_fmsg_u8_pair_put(fmsg, "HW state", state); > + > devlink_fmsg_bool_pair_put(fmsg, "stopped", stopped); > devlink_fmsg_u32_pair_put(fmsg, "cc", sq->cc); > devlink_fmsg_u32_pair_put(fmsg, "pc", sq->pc); > -- LGTM Reviewed-by: Michal Swiatkowski > 2.38.1