DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, Chaoyong He <chaoyong.he@corigine.com>,
	stable@dpdk.org, Long Wu <long.wu@corigine.com>,
	Peng Zhang <peng.zhang@corigine.com>
Subject: [PATCH v2 5/8] net/nfp: fix unreachable loop flow
Date: Thu, 14 Mar 2024 15:40:21 +0800	[thread overview]
Message-ID: <20240314074024.3199555-6-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20240314074024.3199555-1-chaoyong.he@corigine.com>

CI found the loop flow in 'nfp_net_flow_calculate_items()' will never
execute more than once.

Coverity issue: 414941
Fixes: c91c6512d876 ("net/nfp: support Ethernet flow item")
Cc: stable@dpdk.org

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
 drivers/net/nfp/nfp_net_flow.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/nfp/nfp_net_flow.c b/drivers/net/nfp/nfp_net_flow.c
index ff6ce3ee45..251974edb4 100644
--- a/drivers/net/nfp/nfp_net_flow.c
+++ b/drivers/net/nfp/nfp_net_flow.c
@@ -180,6 +180,7 @@ static int
 nfp_net_flow_calculate_items(const struct rte_flow_item items[],
 		uint32_t *match_len)
 {
+	int ret = -EINVAL;
 	const struct rte_flow_item *item;
 
 	for (item = items; item->type != RTE_FLOW_ITEM_TYPE_END; ++item) {
@@ -187,7 +188,8 @@ nfp_net_flow_calculate_items(const struct rte_flow_item items[],
 		case RTE_FLOW_ITEM_TYPE_ETH:
 			PMD_DRV_LOG(DEBUG, "RTE_FLOW_ITEM_TYPE_ETH detected");
 			*match_len = sizeof(struct nfp_net_cmsg_match_eth);
-			return 0;
+			ret = 0;
+			break;
 		case RTE_FLOW_ITEM_TYPE_IPV4:
 			PMD_DRV_LOG(DEBUG, "RTE_FLOW_ITEM_TYPE_IPV4 detected");
 			*match_len = sizeof(struct nfp_net_cmsg_match_v4);
@@ -203,7 +205,7 @@ nfp_net_flow_calculate_items(const struct rte_flow_item items[],
 		}
 	}
 
-	return -EINVAL;
+	return ret;
 }
 
 static int
-- 
2.39.1


  parent reply	other threads:[~2024-03-14  7:41 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-14  7:05 [PATCH 0/8] fix some coverity issues Chaoyong He
2024-03-14  7:05 ` [PATCH 1/8] net/nfp: fix return value check Chaoyong He
2024-03-14  7:05 ` [PATCH 2/8] net/nfp: fix string overflow Chaoyong He
2024-03-14  7:05 ` [PATCH 3/8] net/nfp: fix unreachable control flow Chaoyong He
2024-03-14  7:05 ` [PATCH 4/8] net/nfp: fix check return value Chaoyong He
2024-03-14  7:05 ` [PATCH 5/8] net/nfp: fix unreachable loop flow Chaoyong He
2024-03-14  7:05 ` [PATCH 6/8] net/nfp: fix null pointer dereference Chaoyong He
2024-03-14  7:05 ` [PATCH 7/8] net/nfp: fix dereference after null check Chaoyong He
2024-03-14  7:05 ` [PATCH 8/8] net/nfp: fix tainted scalar Chaoyong He
2024-03-14  7:40 ` [PATCH v2 0/8] fix some coverity issues Chaoyong He
2024-03-14  7:40   ` [PATCH v2 1/8] net/nfp: fix return value check Chaoyong He
2024-03-14  7:40   ` [PATCH v2 2/8] net/nfp: fix string overflow Chaoyong He
2024-03-14  7:40   ` [PATCH v2 3/8] net/nfp: fix unreachable control flow Chaoyong He
2024-03-14  7:40   ` [PATCH v2 4/8] net/nfp: fix check return value Chaoyong He
2024-03-14  7:40   ` Chaoyong He [this message]
2024-03-14  7:40   ` [PATCH v2 6/8] net/nfp: fix null pointer dereference Chaoyong He
2024-03-14  7:40   ` [PATCH v2 7/8] net/nfp: fix dereference after null check Chaoyong He
2024-03-14  7:40   ` [PATCH v2 8/8] net/nfp: fix tainted scalar Chaoyong He
2024-03-14 11:01   ` [PATCH v2 0/8] fix some coverity issues Ferruh Yigit
2024-03-14 10:58 ` [PATCH " Ferruh Yigit
2024-03-14 11:01   ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240314074024.3199555-6-chaoyong.he@corigine.com \
    --to=chaoyong.he@corigine.com \
    --cc=dev@dpdk.org \
    --cc=long.wu@corigine.com \
    --cc=oss-drivers@corigine.com \
    --cc=peng.zhang@corigine.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).