From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 46B795599; Mon, 25 Sep 2017 12:02:29 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga104.jf.intel.com with ESMTP; 25 Sep 2017 03:02:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,435,1500966000"; d="scan'208";a="903556500" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.237.220.57]) ([10.237.220.57]) by FMSMGA003.fm.intel.com with ESMTP; 25 Sep 2017 03:02:26 -0700 To: "Jastrzebski, MichalX K" , "skhare@vmware.com" Cc: "dev@dpdk.org" , "Jain, Deepak K" , "Kulasek, TomaszX" , "yongwang@vmware.com" , "stable@dpdk.org" References: <20170922123906.13308-1-michalx.k.jastrzebski@intel.com> <0dc033ed-f3e4-2f31-dede-7f5295d92e3c@intel.com> <60ABE07DBB3A454EB7FAD707B4BB158213C3EB24@IRSMSX109.ger.corp.intel.com> From: Ferruh Yigit Message-ID: <06abaeee-e1b5-286a-ea47-2258c016f792@intel.com> Date: Mon, 25 Sep 2017 11:02:22 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <60ABE07DBB3A454EB7FAD707B4BB158213C3EB24@IRSMSX109.ger.corp.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH] net/vmxnet3: fix dereference before null check X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Sep 2017 10:02:29 -0000 On 9/25/2017 10:27 AM, Jastrzebski, MichalX K wrote: >> -----Original Message----- >> From: Yigit, Ferruh >> Sent: Friday, September 22, 2017 6:39 PM >> To: Jastrzebski, MichalX K ; >> skhare@vmware.com >> Cc: dev@dpdk.org; Jain, Deepak K ; Kulasek, >> TomaszX ; yongwang@vmware.com; >> stable@dpdk.org >> Subject: Re: [dpdk-stable] [PATCH] net/vmxnet3: fix dereference before null >> check >> >> On 9/22/2017 1:39 PM, Michal Jastrzebski wrote: >>> From: Tomasz Kulasek >>> >>> Coverity error: >>> >>> check_after_deref: Null-checking rq suggests that it may be null, but it >>> has already been dereferenced on all paths leading to >>> the check. >>> >>> This patch moves NULL checking of "rq" at the very beginning of the path >>> before any dereference. >>> >>> Coverity issue: 143468 >>> Fixes: 5aecdc17a97d ("vmxnet3: fix stop/restart") >>> Cc: yongwang@vmware.com >>> Cc: stable@dpdk.org >>> >>> Signed-off-by: Tomasz Kulasek >>> --- >>> drivers/net/vmxnet3/vmxnet3_rxtx.c | 17 ++++++++--------- >>> 1 file changed, 8 insertions(+), 9 deletions(-) >>> >>> diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c >> b/drivers/net/vmxnet3/vmxnet3_rxtx.c >>> index d9cf437..4fcceb4 100644 >>> --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c >>> +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c >>> @@ -259,17 +259,16 @@ >>> { >>> int i; >>> vmxnet3_rx_queue_t *rq = rxq; >>> - struct vmxnet3_hw *hw = rq->hw; >>> struct vmxnet3_cmd_ring *ring0, *ring1; >>> struct vmxnet3_comp_ring *comp_ring; >>> - struct vmxnet3_rx_data_ring *data_ring = &rq->data_ring; >>> int size; >>> >>> - if (rq != NULL) { >> >> vmxnet3_dev_rx_queue_reset() is static function and only called from >> single function [1], which already checks if the parameter is NULL. >> >> What do you think just removing this check and keep rest same? >> >> [1] >> vmxnet3_dev_clear_queues() >> > > Hi Ferruh, > Ok, we can try to do this as You suggest - we will see > what coverity tells about that in the next build. What I understand is, coverity complains about dereferencing variable (rq) before NULL check, so removing NULL check should fix the warning. > As long as vmxnet3_dev_clear_queues() checks if the parameter is NULL, > We can also classify this issue as False/Positive > if our solution in this iteration doesn't help. Agreed, thanks. > > Michal. > <...>