All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/cpfl: fix coverity issue 403269, 403270 and 403272
@ 2023-10-19  9:24 wenjing.qiao
  2023-10-20  0:43 ` Zhang, Qi Z
  0 siblings, 1 reply; 2+ messages in thread
From: wenjing.qiao @ 2023-10-19  9:24 UTC (permalink / raw)
  To: jingjing.wu, beilei.xing; +Cc: dev, qi.z.zhang, Wenjing Qiao

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [PATCH] net/cpfl: fix coverity issue 403269, 403270 and 403272
  2023-10-19  9:24 [PATCH] net/cpfl: fix coverity issue 403269, 403270 and 403272 wenjing.qiao
@ 2023-10-20  0:43 ` Zhang, Qi Z
  0 siblings, 0 replies; 2+ messages in thread
From: Zhang, Qi Z @ 2023-10-20  0:43 UTC (permalink / raw)
  To: Qiao, Wenjing, Wu, Jingjing, Xing, Beilei; +Cc: dev



> -----Original Message-----
> From: Qiao, Wenjing <wenjing.qiao@intel.com>
> Sent: Thursday, October 19, 2023 5:24 PM
> To: Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>; Qiao, Wenjing
> <wenjing.qiao@intel.com>
> Subject: [PATCH] net/cpfl: fix coverity issue 403269, 403270 and 403272
> 
> 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>

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-10-20  0:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-19  9:24 [PATCH] net/cpfl: fix coverity issue 403269, 403270 and 403272 wenjing.qiao
2023-10-20  0:43 ` Zhang, Qi Z

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.