patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, Zerun Fu <zerun.fu@corigine.com>,
	chaoyong.he@corigine.com, stable@dpdk.org,
	Long Wu <long.wu@corigine.com>,
	Peng Zhang <peng.zhang@corigine.com>
Subject: [PATCH] net/nfp: fix misuse of function return values
Date: Wed, 22 Jan 2025 09:33:20 +0800	[thread overview]
Message-ID: <20250122013320.1704468-1-chaoyong.he@corigine.com> (raw)

From: Zerun Fu <zerun.fu@corigine.com>

The 'nfp_ct_offload_add()' return 0 means the result is right
while return negative number means the wrong result.

The caller assigns the 'int' variable to the 'bool' variable.
So the negative number will be transform to 'true'. This will
cause an error because 'true' will be regard as no problem.

Fixes: b4ae16eae01c ("net/nfp: support to add and delete flows to firmware")
Cc: chaoyong.he@corigine.com
Cc: stable@dpdk.org

Signed-off-by: Zerun Fu <zerun.fu@corigine.com>
Reviewed-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/flower/nfp_conntrack.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/nfp/flower/nfp_conntrack.c b/drivers/net/nfp/flower/nfp_conntrack.c
index 0b21e4ee5b..439a1a1b0e 100644
--- a/drivers/net/nfp/flower/nfp_conntrack.c
+++ b/drivers/net/nfp/flower/nfp_conntrack.c
@@ -1440,6 +1440,7 @@ nfp_ct_do_flow_merge(struct nfp_ct_zone_entry *ze,
 		struct nfp_ct_flow_entry *pre_ct_entry,
 		struct nfp_ct_flow_entry *post_ct_entry)
 {
+	int err;
 	bool ret;
 	uint64_t new_cookie[2];
 	uint8_t cnt_same_item = 0;
@@ -1508,9 +1509,10 @@ nfp_ct_do_flow_merge(struct nfp_ct_zone_entry *ze,
 	}
 
 	/* Send to firmware */
-	ret = nfp_ct_offload_add(pre_ct_entry->dev, merge_entry);
-	if (ret != 0) {
+	err = nfp_ct_offload_add(pre_ct_entry->dev, merge_entry);
+	if (err != 0) {
 		PMD_DRV_LOG(ERR, "Send the merged flow to firmware failed.");
+		ret = false;
 		goto merge_table_del;
 	}
 
-- 
2.43.5


                 reply	other threads:[~2025-01-22  1:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20250122013320.1704468-1-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 \
    --cc=zerun.fu@corigine.com \
    /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).