From: wenjing.qiao@intel.com
To: jingjing.wu@intel.com, beilei.xing@intel.com
Cc: dev@dpdk.org, qi.z.zhang@intel.com,
Wenjing Qiao <wenjing.qiao@intel.com>
Subject: [PATCH] net/cpfl: fix coverity issue 403269, 403270 and 403272
Date: Thu, 19 Oct 2023 09:24:19 +0000 [thread overview]
Message-ID: <20231019092418.1477689-1-wenjing.qiao@intel.com> (raw)
From: Wenjing Qiao <wenjing.qiao@intel.com>
Fix logically dead code and dereference before null check
issues reported in coverity scan.
Coverity issue: 403269
Coverity issue: 403270
Coverity issue: 403272
Fixes: 41f20298ee8c ("net/cpfl: parse flow offloading hint from JSON")
Fixes: 6cc97c9971d7 ("net/cpfl: build action mapping rules from JSON")
Signed-off-by: Wenjing Qiao <wenjing.qiao@intel.com>
---
drivers/net/cpfl/cpfl_ethdev.h | 3 +--
drivers/net/cpfl/cpfl_flow_parser.c | 4 ----
2 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/net/cpfl/cpfl_ethdev.h b/drivers/net/cpfl/cpfl_ethdev.h
index efb0eb5251..6f5af4f7f3 100644
--- a/drivers/net/cpfl/cpfl_ethdev.h
+++ b/drivers/net/cpfl/cpfl_ethdev.h
@@ -280,7 +280,6 @@ cpfl_get_port_id(struct cpfl_itf *itf)
static inline uint16_t
cpfl_get_vsi_id(struct cpfl_itf *itf)
{
- struct cpfl_adapter_ext *adapter = itf->adapter;
struct cpfl_vport_info *info;
uint32_t vport_id;
int ret;
@@ -301,7 +300,7 @@ cpfl_get_vsi_id(struct cpfl_itf *itf)
vport_identity.pf_id = CPFL_ACC_CPF_ID;
vport_identity.vf_id = 0;
vport_identity.vport_id = vport_id;
- ret = rte_hash_lookup_data(adapter->vport_map_hash,
+ ret = rte_hash_lookup_data(itf->adapter->vport_map_hash,
&vport_identity,
(void **)&info);
if (ret < 0) {
diff --git a/drivers/net/cpfl/cpfl_flow_parser.c b/drivers/net/cpfl/cpfl_flow_parser.c
index 0e623494a2..412f7feed0 100644
--- a/drivers/net/cpfl/cpfl_flow_parser.c
+++ b/drivers/net/cpfl/cpfl_flow_parser.c
@@ -844,8 +844,6 @@ cpfl_parser_destroy(struct cpfl_flow_js_parser *parser)
for (i = 0; i < parser->pr_size; i++) {
struct cpfl_flow_js_pr *pattern = &parser->patterns[i];
- if (!pattern)
- continue;
for (j = 0; j < pattern->key.proto_size; j++)
rte_free(pattern->key.protocols[j].fields);
rte_free(pattern->key.protocols);
@@ -863,8 +861,6 @@ cpfl_parser_destroy(struct cpfl_flow_js_parser *parser)
for (i = 0; i < parser->mr_size; i++) {
struct cpfl_flow_js_mr *mr = &parser->modifications[i];
- if (!mr)
- continue;
rte_free(mr->key.actions);
rte_free(mr->action.mod.layout);
}
--
2.34.1
next reply other threads:[~2023-10-19 9:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-19 9:24 wenjing.qiao [this message]
2023-10-20 0:43 ` 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=20231019092418.1477689-1-wenjing.qiao@intel.com \
--to=wenjing.qiao@intel.com \
--cc=beilei.xing@intel.com \
--cc=dev@dpdk.org \
--cc=jingjing.wu@intel.com \
--cc=qi.z.zhang@intel.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).