DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/iavf: fix null pointer dereference
@ 2021-01-14  5:23 Simei Su
  2021-01-14  7:53 ` Zhang, Qi Z
  0 siblings, 1 reply; 2+ messages in thread
From: Simei Su @ 2021-01-14  5:23 UTC (permalink / raw)
  To: qi.z.zhang; +Cc: dev, junfeng.guo, jia.guo, yahui.cao, Simei Su

A pointer has already been dereferenced before checking if it is NULL.
It doesn't make any sense, so correct to avoid it.

Fixes: 4f3cfcbc3df3 ("net/iavf: support eCPRI msg type 0 for RSS")
Coverity issue: 365290

Signed-off-by: Simei Su <simei.su@intel.com>
---
 drivers/net/iavf/iavf_hash.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c
index ebaac58..9901f4b 100644
--- a/drivers/net/iavf/iavf_hash.c
+++ b/drivers/net/iavf/iavf_hash.c
@@ -597,11 +597,13 @@ iavf_hash_parse_pattern(const struct rte_flow_item pattern[], uint64_t *phint,
 			break;
 		case RTE_FLOW_ITEM_TYPE_ECPRI:
 			ecpri = item->spec;
-			ecpri_common.u32 = rte_be_to_cpu_32(
-						ecpri->hdr.common.u32);
 			if (!ecpri)
 				break;
-			else if (ecpri_common.type !=
+
+			ecpri_common.u32 = rte_be_to_cpu_32(
+						ecpri->hdr.common.u32);
+
+			if (ecpri_common.type !=
 				 RTE_ECPRI_MSG_TYPE_IQ_DATA) {
 				rte_flow_error_set(error, EINVAL,
 					RTE_FLOW_ERROR_TYPE_ITEM, item,
-- 
2.9.5


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

end of thread, other threads:[~2021-01-14  7:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-14  5:23 [dpdk-dev] [PATCH] net/iavf: fix null pointer dereference Simei Su
2021-01-14  7:53 ` Zhang, Qi Z

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).