DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/ice: fix dereferenced null pointer
@ 2021-10-11  8:25 Simei Su
  2021-10-14  6:26 ` Zhang, Qi Z
  0 siblings, 1 reply; 2+ messages in thread
From: Simei Su @ 2021-10-11  8:25 UTC (permalink / raw)
  To: qi.z.zhang; +Cc: dev, wenjun1.wu, Simei Su

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

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

Signed-off-by: Simei Su <simei.su@intel.com>
---
 drivers/net/ice/ice_ethdev.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 65e43a1..170a127 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -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
-- 
2.9.5


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

end of thread, other threads:[~2021-10-14  6:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-11  8:25 [dpdk-dev] [PATCH] net/ice: fix dereferenced null pointer Simei Su
2021-10-14  6:26 ` 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).