From: Radu Nicolau <radu.nicolau@intel.com>
To: Jingjing Wu <jingjing.wu@intel.com>, Beilei Xing <beilei.xing@intel.com>
Cc: dev@dpdk.org, qi.z.zhang@intel.com,
Radu Nicolau <radu.nicolau@intel.com>,
stable@dpdk.org
Subject: [PATCH] net/iavf: fix IPsec flow create error check
Date: Tue, 11 Oct 2022 10:44:21 +0100 [thread overview]
Message-ID: <20221011094421.3410963-1-radu.nicolau@intel.com> (raw)
Fix an error check where the return code was assigned to a
unsigned integer which can hide negative error codes.
Fixes: 6bc987ecb860 ("net/iavf: support IPsec inline crypto")
Cc: stable@dpdk.org
Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
---
drivers/net/iavf/iavf_ipsec_crypto.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/iavf/iavf_ipsec_crypto.c b/drivers/net/iavf/iavf_ipsec_crypto.c
index afd7f8f467..b50149c0ce 100644
--- a/drivers/net/iavf/iavf_ipsec_crypto.c
+++ b/drivers/net/iavf/iavf_ipsec_crypto.c
@@ -1851,6 +1851,7 @@ iavf_ipsec_flow_create(struct iavf_adapter *ad,
struct rte_flow_error *error)
{
struct iavf_ipsec_flow_item *ipsec_flow = meta;
+ int flow_id = -1;
if (!ipsec_flow) {
rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
@@ -1859,8 +1860,7 @@ iavf_ipsec_flow_create(struct iavf_adapter *ad,
}
if (ipsec_flow->is_ipv4) {
- ipsec_flow->id =
- iavf_ipsec_crypto_inbound_security_policy_add(ad,
+ flow_id = iavf_ipsec_crypto_inbound_security_policy_add(ad,
ipsec_flow->spi,
1,
ipsec_flow->ipv4_hdr.dst_addr,
@@ -1869,8 +1869,7 @@ iavf_ipsec_flow_create(struct iavf_adapter *ad,
ipsec_flow->is_udp,
ipsec_flow->udp_hdr.dst_port);
} else {
- ipsec_flow->id =
- iavf_ipsec_crypto_inbound_security_policy_add(ad,
+ flow_id = iavf_ipsec_crypto_inbound_security_policy_add(ad,
ipsec_flow->spi,
0,
0,
@@ -1880,13 +1879,14 @@ iavf_ipsec_flow_create(struct iavf_adapter *ad,
ipsec_flow->udp_hdr.dst_port);
}
- if (ipsec_flow->id < 1) {
+ if (flow_id < 1) {
rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
"Failed to add SA.");
return -rte_errno;
}
+ ipsec_flow->id = flow_id;
flow->rule = ipsec_flow;
return 0;
--
2.25.1
next reply other threads:[~2022-10-11 9:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-11 9:44 Radu Nicolau [this message]
2022-10-13 3:44 ` Zhang, Qi Z
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=20221011094421.3410963-1-radu.nicolau@intel.com \
--to=radu.nicolau@intel.com \
--cc=beilei.xing@intel.com \
--cc=dev@dpdk.org \
--cc=jingjing.wu@intel.com \
--cc=qi.z.zhang@intel.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).