Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp962440rwe; Thu, 25 Aug 2022 12:26:07 -0700 (PDT) X-Google-Smtp-Source: AA6agR49w/n1Xh3KguZTu3sJ/UigIz6BbnUss/pBzq42hcsGpiMP+boOfOGAdEDherBlEGpPsz8e X-Received: by 2002:aa7:d90e:0:b0:447:986d:b71e with SMTP id a14-20020aa7d90e000000b00447986db71emr4252455edr.235.1661455567056; Thu, 25 Aug 2022 12:26:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661455567; cv=none; d=google.com; s=arc-20160816; b=cTHoYX1rIpBRkFKAZJkms3m3hoNb/AF6DonsfE9IP0tNzm63Um3GPOhSkNv2WtjapT lt33IgQ8t0aQym7rz/89a55UQ2RXUkEbVOBDAKUn1HLWofKMSDVfR4wwU8YXK3Ggg9qC oIvIUVteHxlOUKLQGdiHxyZHxoLY1agP6ibTV8o/nIA8DujvtiA0p3xagRrQwqiMD6OT Y9+V0UXcJFX3mAiolIaf7yXh6tIvaSyMwwWHCnytyTwpLDfsqPFxdRbAZZYQr0LN1qSN EoZ9uRYugwPRj9y5zHUQm+uH0AlKZcH3FoajNWAonaYkRwNnsZL0TigEX6BocUXAnrDb tDiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=LzcSMU79flsCFGsYwPA8jm006j9ntJHVrXRums+x4hg=; b=F3nyY9AcIHucQbar+BJiskppLbWwg31DK6L/nYHxmzVCVscJk//22uLyav5boqCZg9 uA10TxU6e6USo5NxPCRGdnY1wf7Wfg1ZsBJuogSBskRcJZtKTpvBIMQxQAqkV/wBTuc/ 7/B1aiby6cq4wK0Pa9r1az8WflisOMTdJAP8PnEQdsbzJGd9yDpYCn8n1xZT2XFebTE9 dyArMETReUXijuUTkfhIuuNIsfLW/LD7y5ycdZfpx691OcQ8scmw01Np8/WXV13PRwP7 pKHN3nJR0pEjPyuOa/pc6tT5dbaw0JthME9ABpWKMTV5YB45NlPM3J2t22/rIFP2nHHK 3aAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=SYv3Q3Aa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id he30-20020a1709073d9e00b0073d74e1a466si20381ejc.390.2022.08.25.12.25.41; Thu, 25 Aug 2022 12:26:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=SYv3Q3Aa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230523AbiHYSUF (ORCPT + 99 others); Thu, 25 Aug 2022 14:20:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233141AbiHYSUC (ORCPT ); Thu, 25 Aug 2022 14:20:02 -0400 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFE4226CD for ; Thu, 25 Aug 2022 11:20:00 -0700 (PDT) Received: by mail-lf1-x12b.google.com with SMTP id l1so28789063lfk.8 for ; Thu, 25 Aug 2022 11:20:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=LzcSMU79flsCFGsYwPA8jm006j9ntJHVrXRums+x4hg=; b=SYv3Q3AaGa03fEqdwIrUan3UK8SVmw9Z+8W0B7f1Bj2B8+vTNPtKhvy5T89n7XvozG NDgrl5LlirpCD9r3IS2kZBXYAE8dV6QP7j2D5koQYtr3nUg9jAbPihRKFqrhn5RwEcp7 BZd5umqi6jfrO6Cx8Bgf7w4lG0lyQa4YV0Q/DkOpfm5hmLCPyrSHeF6USOHTKnb82axs UbqNS0wIZUyhVt9oIeAumA1MQ798CrLeXJrUDk7NUqGzWAQI6IfNL7t9zG0bFBciPxy1 +Yq1LnHzDtJzsiTKE4JhDpzYlvm+dVVQN2UNFpkKFOEdD6wZ+Y0MP9sxzTcXJXAlNHDb gwcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=LzcSMU79flsCFGsYwPA8jm006j9ntJHVrXRums+x4hg=; b=aWo8bzdOniNfeuXPXDFramOqGGjhl2FPwRedMxT0B9gv299zjxkogrwU+V/Gpm3UCq AG7kLQQhOAEjlwWrfG4z9he6lijJkNywzQNdoN9Y2cCSupECYruy+gtmEDe5uYKtSMf+ 1TzAheXfXR7oU5bPpBnufLY3IyBu4Ryt/S8xpXZfbG1BfQVz1Vxngv9/NMA3emJ5W9oQ Bp90G3BtC8UnwVnE7sGyQVU1bI93WyekZQ3K39sO3kt1PKJkbR5JlPCeGVdJ293KSSCG 4kQY5b4cex0GkjrewJxBlnnxz7LRVul6cNcOaGfXPcRwE/3UpaWh6UPDJnKUBa7U79nc uEzw== X-Gm-Message-State: ACgBeo3n1ZY/NGTI1bDUJn3+N7VZl9mQq9l4KWaa68AxVM7QnWCmrl9n Bui0LNhQMb6KQoC9eGLvW4qL4Hcqo8kw6tUjGlx7Wg== X-Received: by 2002:a05:6512:158b:b0:48b:38:cff8 with SMTP id bp11-20020a056512158b00b0048b0038cff8mr1399470lfb.100.1661451598905; Thu, 25 Aug 2022 11:19:58 -0700 (PDT) MIME-Version: 1.0 References: <20220825180607.2707947-1-nathan@kernel.org> In-Reply-To: <20220825180607.2707947-1-nathan@kernel.org> From: Nick Desaulniers Date: Thu, 25 Aug 2022 11:19:47 -0700 Message-ID: Subject: Re: [PATCH net-next] net/mlx5e: Do not use err uninitialized in mlx5e_rep_add_meta_tunnel_rule() To: Nathan Chancellor Cc: Saeed Mahameed , Leon Romanovsky , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Tom Rix , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, patches@lists.linux.dev Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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 On Thu, Aug 25, 2022 at 11:06 AM Nathan Chancellor wrote: > > Clang warns: > > drivers/net/ethernet/mellanox/mlx5/core/en_rep.c:481:6: error: variable 'err' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] > if (IS_ERR(flow_rule)) { > ^~~~~~~~~~~~~~~~~ > drivers/net/ethernet/mellanox/mlx5/core/en_rep.c:489:9: note: uninitialized use occurs here > return err; > ^~~ > drivers/net/ethernet/mellanox/mlx5/core/en_rep.c:481:2: note: remove the 'if' if its condition is always true > if (IS_ERR(flow_rule)) { > ^~~~~~~~~~~~~~~~~~~~~~~ > drivers/net/ethernet/mellanox/mlx5/core/en_rep.c:474:9: note: initialize the variable 'err' to silence this warning > int err; > ^ > = 0 > 1 error generated. > > There is little reason to have the 'goto + error variable' construct in > this function. Get rid of it and just return the PTR_ERR value in the if > statement and 0 at the end. > > Fixes: 430e2d5e2a98 ("net/mlx5: E-Switch, Move send to vport meta rule creation") > Link: https://github.com/ClangBuiltLinux/linux/issues/1695 > Signed-off-by: Nathan Chancellor Thanks for the fix! Reviewed-by: Nick Desaulniers > --- > drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 10 +++------- > 1 file changed, 3 insertions(+), 7 deletions(-) > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c > index c8617a62e542..a977804137a8 100644 > --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c > @@ -471,22 +471,18 @@ mlx5e_rep_add_meta_tunnel_rule(struct mlx5e_priv *priv) > struct mlx5_eswitch_rep *rep = rpriv->rep; > struct mlx5_flow_handle *flow_rule; > struct mlx5_flow_group *g; > - int err; > > g = esw->fdb_table.offloads.send_to_vport_meta_grp; > if (!g) > return 0; > > flow_rule = mlx5_eswitch_add_send_to_vport_meta_rule(esw, rep->vport); > - if (IS_ERR(flow_rule)) { > - err = PTR_ERR(flow_rule); > - goto out; > - } > + if (IS_ERR(flow_rule)) > + return PTR_ERR(flow_rule); > > rpriv->send_to_vport_meta_rule = flow_rule; > > -out: > - return err; > + return 0; > } > > static void > > base-commit: c19d893fbf3f2f8fa864ae39652c7fee939edde2 > -- > 2.37.2 > -- Thanks, ~Nick Desaulniers