Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp174638lqo; Tue, 7 May 2024 16:41:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWHOnqzduL3V8jgN2o/55/GzRq3NU4ZgZkomTzn/noa9ngY688YpzHVhmF+Yg+g+G7jOPwqmZGh//+5fMZcY3654c7we2WAeiEqcu3kiQ== X-Google-Smtp-Source: AGHT+IHPO8GQgXKecgjhLdWW1spw6gB9FkNb99z6x+uK3JkEoGYVPR96Kw68Ovm0p0GquWqa5xwj X-Received: by 2002:a17:90a:d712:b0:2a2:fec9:1bbd with SMTP id 98e67ed59e1d1-2b5bc2ad42dmr5862800a91.17.1715125298410; Tue, 07 May 2024 16:41:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715125298; cv=pass; d=google.com; s=arc-20160816; b=TF87iIlzgIH299uqoFC/cKl8polxruwKqw+/WDFKjiZbSANCONkskcMGA9z5VEaCO/ bILhINfdzk70iDO1d+9sLe3o9ASyuCkDFAd16oF5HEKIYftMdcmAr+tWwsjfY/6Lj+VT sj7o//CvvcAWrg2xnWq+G8cCI6djl3KML9PGlxLJjRlpJYFuZEzNlzpoekXEIMSK+iJr IMWr/Rv6Ul2VnD4bQ2A+HvAmYUyhiOHz0sqt4QxKmntLVXA9aT/AMR7abht5RAVJurKn 29NJoIPhX+H5kqq1C30Rl+Xx5QG+3BpYvUlO7fpk7XoXy2qfU2WErqWgEw7/9rQVc4BE JuIQ== 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=H7E6FmtsG+i1T+cfonajLDDSD8QQ5QPNeOZtdwpKOyWETI4EUTZpPu+I4ScyVvLZAa w9nvFCBFXKrokKqPQoYSoAMkWuTz4PLaa888Uv15A7Unb8F+922ptO6AOhu0CcSjgtzc U/a6DagPjUC2pb+yKT34kvPddTMUDsoebjix2CF7/UsQwMuk+zhiWXmVO9Ht9WYkliDe RanuR4FrR8WREnygV/X+kU3SQaJtHxvEKNQF5YNZ20e3DEVTQRDeXuCixfH2iF108MpQ eW5Bkvk/8IP/IUo9qgK6Xiz6vmyP6qnNWYK+x3rGA3uuYpdqxujcFKr5K5BMsmWaAyUW sqlQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ALOE7BSB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-172418-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172418-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id c11-20020a17090abf0b00b002b20c2de966si147825pjs.56.2024.05.07.16.41.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 16:41:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-172418-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ALOE7BSB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-172418-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172418-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 4721828720E for ; Tue, 7 May 2024 23:40:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DBD69137776; Tue, 7 May 2024 23:11:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ALOE7BSB" 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 07A8314D2B4; Tue, 7 May 2024 23:11:18 +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=1715123479; cv=none; b=GuRu5ZR55px00jk9j1OZVV30hiIrWBG4UGwniW0lttaHjWTbXz0WqgEi3PnRnMkE5/laCkVq5VrAgl3TUSESy8aMox7AkasL80MUbqeUbFhUlbW8HFCeDwQIbatH/fGIBG+ZpRvR6DsLVIDxuhsJFrEvLXe5fcXccTQfeyp+Hy8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715123479; 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=YW8GYkJfwdE+xNTJBcf3D2qg6O5Ca5ghPy5hOog5J0qWWduf70RxD7zXCFY523GyEU97T3WCbGo0aXr5YU2D5qDi4Vd+k4g3PJ05UPXhda0XrbqmRe9mmaVQxanDfi350eDD5bc1HGLkl6ulBkYKA/2nx3lArkIFSaTB1rrvUms= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ALOE7BSB; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 524D5C2BBFC; Tue, 7 May 2024 23:11:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715123478; bh=P9+Xv74RFVSFodo/2jDBWm/cubv4cnUm6GU0sms+K4A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ALOE7BSBDL0X3wIPJqLiAQGTMav/0Y8vedhnAHw/pGm+tfE4e2NuNN7v2wlvW9ox7 MssKT6kE0PyDqNrz2VfBkOtUL/iRZBn2TBHRTvPQlNwliZh6r70C6LHozpuLjNExa8 exD+djQdluPiCIxlH145LoI/mGHVKH5BSY79hJCZVUCmWjSxOWIrkyoxe4pDDEpXG0 2T1c7/KVIygmewX2tKPnTb0yX9BK3OzZHox/f37Z8yP20juC8YrfUNU50x9d1nTIdC lGFGKRRL47F4PnbxgroqsB/cDHV1wmFebQ/3iNzNCAT4uz5zf1XMmu5WQDEQiias6a P6xRQOFLoJ7JA== 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.6 23/43] net: qede: sanitize 'rc' in qede_add_tc_flower_fltr() Date: Tue, 7 May 2024 19:09:44 -0400 Message-ID: <20240507231033.393285-23-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240507231033.393285-1-sashal@kernel.org> References: <20240507231033.393285-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.6.30 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