From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A96E7A034F; Mon, 11 Oct 2021 10:36:43 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 92CCE410E2; Mon, 11 Oct 2021 10:36:43 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 92796410E1 for ; Mon, 11 Oct 2021 10:36:41 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10133"; a="226785420" X-IronPort-AV: E=Sophos;i="5.85,364,1624345200"; d="scan'208";a="226785420" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2021 01:36:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,364,1624345200"; d="scan'208";a="479771459" Received: from unknown (HELO npg-dpdk-cvl-simeisu-118d193.sh.intel.com) ([10.67.119.218]) by orsmga007.jf.intel.com with ESMTP; 11 Oct 2021 01:36:38 -0700 From: Simei Su To: qi.z.zhang@intel.com Cc: dev@dpdk.org, wenjun1.wu@intel.com, Simei Su Date: Mon, 11 Oct 2021 16:25:25 +0800 Message-Id: <20211011082525.87965-1-simei.su@intel.com> X-Mailer: git-send-email 2.9.5 Subject: [dpdk-dev] [PATCH] net/ice: fix dereferenced null pointer X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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