From: Junfeng Guo <junfeng.guo@intel.com>
Date: Wed, 13 Oct 2021 10:34:55 +0000 (+0000)
Subject: net/ice/base: fix null pointer dereferences for parser
X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=c2450e933f01d4d31448240f7304730292db7ee8;p=dpdk.git

net/ice/base: fix null pointer dereferences for parser

Null-checking "p" suggests that it may be null, but it has already
been dereferenced on all paths leading to the check. Thus correct
the code lines and remove the redundant line.

Fixes: c84f8aa2100c ("net/ice/base: add parser runtime skeleton")

Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
---

diff --git a/drivers/net/ice/base/ice_parser.c b/drivers/net/ice/base/ice_parser.c
index 690004e6e2..9b106baff0 100644
--- a/drivers/net/ice/base/ice_parser.c
+++ b/drivers/net/ice/base/ice_parser.c
@@ -167,13 +167,11 @@ enum ice_status ice_parser_create(struct ice_hw *hw, struct ice_parser **psr)
 	struct ice_parser *p;
 
 	p = (struct ice_parser *)ice_malloc(hw, sizeof(struct ice_parser));
-	p->hw = hw;
-	p->rt.psr = p;
-
 	if (!p)
 		return ICE_ERR_NO_MEMORY;
 
 	p->hw = hw;
+	p->rt.psr = p;
 
 	p->imem_table = ice_imem_table_get(hw);
 	if (!p->imem_table) {