Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp170042lqo; Tue, 7 May 2024 16:28:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVaOyPGwROYiM9jsmQsibyIUS1URpclU5pCveXRT/Qk7rl17uKmGtGx75RWOuQkcqX9Nc5TB7ukPJZt7glTlxrSzXZoGTxFAJGK4jS3+g== X-Google-Smtp-Source: AGHT+IE07xX/WS3yIrd1HeEyZgqNcVIBoMOiwT6OaFXTAA4MSWXyl/bjtJeJOYpq8libTNSah3c8 X-Received: by 2002:a05:6102:124a:b0:47e:f5a5:1a3c with SMTP id ada2fe7eead31-47f3c296b47mr893130137.7.1715124536676; Tue, 07 May 2024 16:28:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715124536; cv=pass; d=google.com; s=arc-20160816; b=TuFZIKkOSPlixK0polhPFJ7LErbvdkEqk059+Lu4CfrHm9BZdajdWBhSZ5SddbRkzJ 1Tt1vn7O6fI4cauwaoRFdbVzlQ2sfTxq5X2/MeR5VLAoLmTjMVtEgR8cT5xkNfPI6hTk t0vPSwD3hztY1eVYwaW6u8/0KH9rEGwDJ8Y1lZIaf5JuEAZQ3clnTdNEN1+4sOLApc5S JJwlasnEHMWHX7DTsFvqTJVsGo8Vru7p9OmLlzp0TU4Dy/iAVh2Xr2aj20+6+T+AgQAf OmmNNrhgYrCGZ2kePlBh1QxMmVTWx/qF0sYvFDcJ0/RgdcLo/r2KZqyP6LkebYeH1PA4 YyUg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=V/QxMxv18BhEJmLS6FMVcx87Tepo3c04BHgCRssXN14=; fh=qiC+RQujrJbHMbJh/UpCxtlaxpsWNYg+TANSoWhq2jU=; b=RklSLB6DenEFh4E/9BUcwmmRpl3mDMra++FcrdGmU/MQWN1jk+1gvuxM1FmsODuyUC mISp18/JRjZGZu61ilMcuCQGKnMSWmy0QOdqQeOfxcD9PdClv5Lg9JGFAZAR42gNjrJK 2xF7d1K5YmemiEMEm5oHZbrYCKta41pNHNtnMp5gCf8X9/WYCChxlIdGBWEyinBoiOW+ lbFpnElJcFeyIDxPOK/vjX+LH3z2b7JHBo3DDBtDXDvRV3GWBxKiebAPbXem8lcTCwkL ipp596cf927daw1kkP+jx5K8tn7M0AJUW4cZYujUPvicGtzURcHxjYdUrH+etNap01Wj JsSQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=B51bK4tL; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-172370-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172370-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id f12-20020a056214076c00b0069b5f5c3d73si12601008qvz.172.2024.05.07.16.28.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 16:28:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-172370-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=B51bK4tL; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-172370-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172370-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 4AAD61C222A1 for ; Tue, 7 May 2024 23:28:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CDE1113F45B; Tue, 7 May 2024 23:08:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="B51bK4tL" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED23513F442; Tue, 7 May 2024 23:08:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715123336; cv=none; b=khlL6wcoEw0NR3A/pzsVJeE2BBpIgnSzamlQjWHEEG37CG2bg08f3M82MU6XHI6Fe3Q5yAVmVjsjd8Bqm3xBSe/RJY02UimzTzvtRmms7713hLDVqqLRkgC4TnzMoTnrtJWmTOqhY2bWVfUzTBgu0BpzUsEXIUTlgt5gqLQqSLI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715123336; c=relaxed/simple; bh=P9+Xv74RFVSFodo/2jDBWm/cubv4cnUm6GU0sms+K4A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=sdEMLaixHNRT2vcC+HUZnQm/l5vFXIPZii4bZXG3pyffXKhPsUkGpD3Qhxp3REDoRscY/xHVLgMMHxDbLz+0cUX0JriPMA8caM1Idm370SLD47SS0aqdOAov2xdYd5I6ukFaPV9GwGNICPKIlz1rwI1cix2QQrkeTDI37WjsY1o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=B51bK4tL; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E5BFC3277B; Tue, 7 May 2024 23:08:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715123335; bh=P9+Xv74RFVSFodo/2jDBWm/cubv4cnUm6GU0sms+K4A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B51bK4tLNSWnA2+CBa36+PTWN2p84upaq8D8xvXn2M3BaCJsQLqNKjdX3gw9ry2SR LX6DA5zx7M6xnL4ZA8/8SkRfMiN5nxQmA0t46H2EdRegiLDTwL8HNrNmVWKXR1WRSV IEkwFv5eXZQmukLh/pLBqjFZdeaKgqZteVekf299+wNn555ofUY1Jm+YzfT5zaa4vl ZyEp57ykaavcsANclxsVCxirJuf5SQQhodRqe2q4tPreFaL1wGf+izCuIyGcPToq48 skQpOIMOKtblHK/1kDuxjAcatXQw6xCFnJSUzZg/PhaRVqbM9PphIqxZCzuRvRM6uI HbcXoO2M2s8mQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= , Simon Horman , "David S . Miller" , Sasha Levin , manishc@marvell.com, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 6.8 28/52] net: qede: sanitize 'rc' in qede_add_tc_flower_fltr() Date: Tue, 7 May 2024 19:06:54 -0400 Message-ID: <20240507230800.392128-28-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240507230800.392128-1-sashal@kernel.org> References: <20240507230800.392128-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.8.9 Content-Transfer-Encoding: 8bit From: Asbjørn Sloth Tønnesen [ Upstream commit e25714466abd9d96901b15efddf82c60a38abd86 ] Explicitly set 'rc' (return code), before jumping to the unlock and return path. By not having any code depend on that 'rc' remains at it's initial value of -EINVAL, then we can re-use 'rc' for the return code of function calls in subsequent patches. Only compile tested. Signed-off-by: Asbjørn Sloth Tønnesen Reviewed-by: Simon Horman Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/qlogic/qede/qede_filter.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qede/qede_filter.c b/drivers/net/ethernet/qlogic/qede/qede_filter.c index a5ac21a0ee33f..8ecdfa36a6854 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_filter.c +++ b/drivers/net/ethernet/qlogic/qede/qede_filter.c @@ -1868,8 +1868,8 @@ int qede_add_tc_flower_fltr(struct qede_dev *edev, __be16 proto, struct flow_cls_offload *f) { struct qede_arfs_fltr_node *n; - int min_hlen, rc = -EINVAL; struct qede_arfs_tuple t; + int min_hlen, rc; __qede_lock(edev); @@ -1879,8 +1879,10 @@ int qede_add_tc_flower_fltr(struct qede_dev *edev, __be16 proto, } /* parse flower attribute and prepare filter */ - if (qede_parse_flow_attr(edev, proto, f->rule, &t)) + if (qede_parse_flow_attr(edev, proto, f->rule, &t)) { + rc = -EINVAL; goto unlock; + } /* Validate profile mode and number of filters */ if ((edev->arfs->filter_count && edev->arfs->mode != t.mode) || @@ -1888,12 +1890,15 @@ int qede_add_tc_flower_fltr(struct qede_dev *edev, __be16 proto, DP_NOTICE(edev, "Filter configuration invalidated, filter mode=0x%x, configured mode=0x%x, filter count=0x%x\n", t.mode, edev->arfs->mode, edev->arfs->filter_count); + rc = -EINVAL; goto unlock; } /* parse tc actions and get the vf_id */ - if (qede_parse_actions(edev, &f->rule->action, f->common.extack)) + if (qede_parse_actions(edev, &f->rule->action, f->common.extack)) { + rc = -EINVAL; goto unlock; + } if (qede_flow_find_fltr(edev, &t)) { rc = -EEXIST; -- 2.43.0