From: Simei Su Date: Mon, 11 Oct 2021 08:25:25 +0000 (+0800) Subject: net/ice: fix dereferenced null pointer X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=9f8c4cf02d4cb7c88000d4224b42f7d76d4fa8dd;p=dpdk.git 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") Signed-off-by: Simei Su Acked-by: Qi Zhang --- diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 65e43a18f9..170a12759d 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