Message ID | 20230619091215.2731541-2-arnd@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2872544vqr; Mon, 19 Jun 2023 02:31:22 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4CJPo+W9tI4JjSp31agUnOpkGMZTlkXymQqCoubxGzOV+UChDRUYY4W8FWNDS4UDSbQema X-Received: by 2002:a17:903:124d:b0:1b0:3a74:7fc4 with SMTP id u13-20020a170903124d00b001b03a747fc4mr5908804plh.24.1687167082468; Mon, 19 Jun 2023 02:31:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687167082; cv=none; d=google.com; s=arc-20160816; b=IhRVz7gJ4XU35A7f4OpxcOoCqnrCslNTgzEDTNM1ls33PCqhEJ8edgVlZmkkTM0Kzj ZqpqdAZi18EIB0/wR3jC2dxJgNb8UPSHHvyHny8sZEsEsLLdcAr0Z/d8KcZ6r1yN/G8K aCn/Z9Zuwxz5+q8C409ty4upFI3EYvYROlRuVoio9RuzCu1vKLfgthSbZloAUkAjor2Y bHD62qxqTuXoLCWRz//Mq1vcVoNVJDVvx5RbGeVeHSiXWArr51XcH6UQMMTc7nKhnYi3 f4YuxNVYNe73nPWTdBgXlad5G9k/lC9mjcQBWFLD5NC1c8f37jy9wUajxB+DWgV1TMwd 2uZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=9RgSrqOXDzLzDu3AQNjJRuYFgjQDZpxUNMVaWhMCUos=; b=y4/nW7POD4XboYtUYaCRAItWc82JOXUZZYMTu7fO2VWyaXXQrWZR/A/5jcIV83yJoo HmdJtvNZ1hVAzSGUpSYIdgdKocRwRId+CktikBdwM9srLtdwiz/mipcFVkLR7Bl5TDJI uSp/+LDYKTF4uBKV1fW7VC1ui5dkpO7gdLUUMB8wPCXFLZw2TzOYaQy3VdB3FekL8dtd IK6MZZmwD5AVgM4oABgIh/zxm3YI6O489uIw/zeFiLI6AQzRiM1XRcPSW21iou4ZCFv2 MgHfYs9NsJY1ocX5HvnotiTkEuDwS4JHsaFFTacSRd8eZHiyn/gPwlCueDb27hkuGBsM m7Ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EI4Wja3f; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u11-20020a170903124b00b001a970d40828si7219720plh.603.2023.06.19.02.31.10; Mon, 19 Jun 2023 02:31:22 -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=@kernel.org header.s=k20201202 header.b=EI4Wja3f; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231214AbjFSJMk (ORCPT <rfc822;duw91626@gmail.com> + 99 others); Mon, 19 Jun 2023 05:12:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231185AbjFSJMf (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 19 Jun 2023 05:12:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0E84CC for <linux-kernel@vger.kernel.org>; Mon, 19 Jun 2023 02:12:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5F30060AB1 for <linux-kernel@vger.kernel.org>; Mon, 19 Jun 2023 09:12:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36D1EC433C8; Mon, 19 Jun 2023 09:12:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687165952; bh=C9Nk9/QP6OPS4jxNq9hz3jeu3Lte1JDyc4vSyqZJLlw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EI4Wja3flSrNux6FdpjGVJbrxdVm96gT6eM4VzNrbswJM0uodSDk5Ny98EBcrTPAX M+nJCf9Y4F2zYmbmZMFjWR5Ux53L2VGT8pN+U65LD9Qbec8/wLQcrXn5BY2CtpVZ1/ 7LRnas0WmzZJjvBIaOtxVE1XfMvucTnC1gxS56itWF8nnJr3YChTrmgs51sA45plAV EWvlI3oOmInYXr1EEkHJWQCtgQmUQqb54Hs1UMr1olj96m/e613rbUH+fL+wnoO5Yp 81NdcYmSMl36difwuNyajHwFZEq0UZirKi1sjoCOJyePipnlFGL348WmynOogkR6nw zZFlxlU4VoYbw== From: Arnd Bergmann <arnd@kernel.org> To: Edward Cree <ecree.xilinx@gmail.com>, Martin Habets <habetsm.xilinx@gmail.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Pieter Jansen van Vuuren <pieter.jansen-van-vuuren@amd.com>, Simon Horman <simon.horman@corigine.com> Cc: Arnd Bergmann <arnd@arndb.de>, netdev@vger.kernel.org, linux-net-drivers@amd.com, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] [v2] sfc: fix uninitialized variable use Date: Mon, 19 Jun 2023 11:12:10 +0200 Message-Id: <20230619091215.2731541-2-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230619091215.2731541-1-arnd@kernel.org> References: <20230619091215.2731541-1-arnd@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769122910170516946?= X-GMAIL-MSGID: =?utf-8?q?1769122910170516946?= |
Series |
[1/3,v2] sfc: add CONFIG_INET dependency for TC offload
|
|
Commit Message
Arnd Bergmann
June 19, 2023, 9:12 a.m. UTC
From: Arnd Bergmann <arnd@arndb.de> The new efx_bind_neigh() function contains a broken code path when IPV6 is disabled: drivers/net/ethernet/sfc/tc_encap_actions.c:144:7: error: variable 'n' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized] if (encap->type & EFX_ENCAP_FLAG_IPV6) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/net/ethernet/sfc/tc_encap_actions.c:184:8: note: uninitialized use occurs here if (!n) { ^ drivers/net/ethernet/sfc/tc_encap_actions.c:144:3: note: remove the 'if' if its condition is always false if (encap->type & EFX_ENCAP_FLAG_IPV6) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/net/ethernet/sfc/tc_encap_actions.c:141:22: note: initialize the variable 'n' to silence this warning struct neighbour *n; ^ = NULL Change it to use the existing error handling path here. Fixes: 7e5e7d800011a ("sfc: neighbour lookup for TC encap action offload") Suggested-by: Edward Cree <ecree.xilinx@gmail.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- v2: use 'goto' instead of incorrectly entering another error path --- drivers/net/ethernet/sfc/tc_encap_actions.c | 1 + 1 file changed, 1 insertion(+)
Comments
On 19/06/2023 10:12, Arnd Bergmann wrote: > From: Arnd Bergmann <arnd@arndb.de> > > The new efx_bind_neigh() function contains a broken code path when IPV6 is > disabled: > > drivers/net/ethernet/sfc/tc_encap_actions.c:144:7: error: variable 'n' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized] > if (encap->type & EFX_ENCAP_FLAG_IPV6) { > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > drivers/net/ethernet/sfc/tc_encap_actions.c:184:8: note: uninitialized use occurs here > if (!n) { > ^ > drivers/net/ethernet/sfc/tc_encap_actions.c:144:3: note: remove the 'if' if its condition is always false > if (encap->type & EFX_ENCAP_FLAG_IPV6) { > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > drivers/net/ethernet/sfc/tc_encap_actions.c:141:22: note: initialize the variable 'n' to silence this warning > struct neighbour *n; > ^ > = NULL > > Change it to use the existing error handling path here. > > Fixes: 7e5e7d800011a ("sfc: neighbour lookup for TC encap action offload") > Suggested-by: Edward Cree <ecree.xilinx@gmail.com> > Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Edward Cree <ecree.xilinx@gmail.com> > --- > v2: use 'goto' instead of incorrectly entering another error path > --- > drivers/net/ethernet/sfc/tc_encap_actions.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/net/ethernet/sfc/tc_encap_actions.c b/drivers/net/ethernet/sfc/tc_encap_actions.c > index aac259528e73e..7e8bcdb222ad1 100644 > --- a/drivers/net/ethernet/sfc/tc_encap_actions.c > +++ b/drivers/net/ethernet/sfc/tc_encap_actions.c > @@ -164,6 +164,7 @@ static int efx_bind_neigh(struct efx_nic *efx, > */ > rc = -EOPNOTSUPP; > NL_SET_ERR_MSG_MOD(extack, "No IPv6 support (neigh bind)"); > + goto out_free; > #endif > } else { > rt = ip_route_output_key(net, &flow4); >
diff --git a/drivers/net/ethernet/sfc/tc_encap_actions.c b/drivers/net/ethernet/sfc/tc_encap_actions.c index aac259528e73e..7e8bcdb222ad1 100644 --- a/drivers/net/ethernet/sfc/tc_encap_actions.c +++ b/drivers/net/ethernet/sfc/tc_encap_actions.c @@ -164,6 +164,7 @@ static int efx_bind_neigh(struct efx_nic *efx, */ rc = -EOPNOTSUPP; NL_SET_ERR_MSG_MOD(extack, "No IPv6 support (neigh bind)"); + goto out_free; #endif } else { rt = ip_route_output_key(net, &flow4);