Skip to contentSkip to conversation

net/ice: fix dereferenced null pointer

PATCH Applied Simei Su 2 participants 2 messages Oct 11, 2021 – Oct 14, 2021 Network drivers

lore
Share & tools
lore

Simei Su

author
#0 lore raw

PATCH 1/1 net/ice: fix dereferenced null pointer

This patch fixes coverity issue by avoiding use of null pointer in taking false branch.

Coverity issue: 373360

Fixes 437dbd2fd428 ("net/ice: support 1PPS")
---
 drivers/net/ice/ice_ethdev.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/net/ice/ice_ethdev.c +7 -7
index 65e43a1..170a127 100644
@@ -1854,18 +1854,18 @@ parse_pin_set(const char *input, int pps_type, struct ice_devargs *devargs)
 		idx = strtoul(str, &end, 10);
 		if (end == NULL || idx >= ICE_MAX_PIN_NUM)
 			return -1;
+		while (isblank(*end))
+			end++;
+		if (*end != ']')
+			return -1;
 
 		devargs->pin_idx = idx;
 		devargs->pps_out_ena = 1;
-	}
-
-	while (isblank(*end))
-		end++;
 
-	if (*end != ']')
-		return -1;
+		return 0;
+	}
 
-	return 0;
+	return -1;
 }
 
 static int
Signature · 1 line
2.9.5
Acked-by on v1 1/1 Applied
#1 lore raw
Quoted 10 lines

-----Original Message-----
From: Su, Simei <[email protected]>
Sent: Monday, October 11, 2021 4:25 PM
To: Zhang, Qi Z <[email protected]>
Cc: [email protected]; Wu, Wenjun1 <[email protected]>; Su, Simei <[email protected]>
Subject: [PATCH] net/ice: fix dereferenced null pointer

Quoted 7 lines

This patch fixes coverity issue by avoiding use of null pointer in taking false branch.

Coverity issue: 373360

Fixes 437dbd2fd428 ("net/ice: support 1PPS")

Applied to dpdk-next-net-intel.

Thanks
Qi