Skip to contentSkip to conversation

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

PATCH Applied Junfeng Guo 2 participants 2 messages Oct 13, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
---
 drivers/net/ice/base/ice_parser.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ice/base/ice_parser.c +1 -3
index 690004e6e2..9b106baff0 100644
@@ -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) {
Signature · 1 line
2.25.1
Acked-by on v1 1/1 Applied
#1 lore raw
Quoted 11 lines

-----Original Message-----
From: Guo, Junfeng <[email protected]>
Sent: Wednesday, October 13, 2021 6:35 PM
To: Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>
Cc: [email protected]; [email protected]; Yigit, Ferruh <[email protected]>; Guo, Junfeng <[email protected]>
Subject: [PATCH] net/ice/base: fix null pointer dereferences for parser

Quoted 8 lines

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

Applied to dpdk-next-net-intel.

Thanks
Qi