From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 9137B2C14 for ; Fri, 22 Apr 2016 03:04:09 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 21 Apr 2016 18:04:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,515,1455004800"; d="scan'208";a="937660368" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga001.jf.intel.com with ESMTP; 21 Apr 2016 18:04:09 -0700 Received: from fmsmsx111.amr.corp.intel.com (10.18.116.5) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 21 Apr 2016 18:04:07 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx111.amr.corp.intel.com (10.18.116.5) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 21 Apr 2016 18:04:07 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.229]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.69]) with mapi id 14.03.0248.002; Fri, 22 Apr 2016 09:04:05 +0800 From: "Zhang, Helin" To: Stephen Hemminger CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH 1/6] i40e: fix problematic dereference Thread-Index: AQHRm3/50oDNIK/Thk+WzKADhOIVaZ+UE3yAgAEZ3PA= Date: Fri, 22 Apr 2016 01:04:04 +0000 Message-ID: References: <1461210177-29330-1-git-send-email-helin.zhang@intel.com> <1461210177-29330-2-git-send-email-helin.zhang@intel.com> <20160421091019.348a1777@xeon-e3> In-Reply-To: <20160421091019.348a1777@xeon-e3> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiN2Y2YzM5ZDUtNTdlMy00ZTU4LTg4MjEtZTFhM2U4YTE5NGJkIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IksrYnNVa29JRDdFNFVQbGJVSVpDclZtWFhIMTk2UHBLTTNVejFhUFMxOW89In0= x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH 1/6] i40e: fix problematic dereference X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Apr 2016 01:04:10 -0000 > -----Original Message----- > From: Stephen Hemminger [mailto:stephen@networkplumber.org] > Sent: Friday, April 22, 2016 12:10 AM > To: Zhang, Helin > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH 1/6] i40e: fix problematic dereference >=20 > On Thu, 21 Apr 2016 11:42:52 +0800 > Helin Zhang wrote: >=20 > > Fix issue reported by Coverity. > > > > Coverity ID 119267: Dereference before null check. > > > > Fixes: 8e109464c022 ("i40e: allow vector Rx and Tx usage") > > > > Signed-off-by: Helin Zhang > > --- > > drivers/net/i40e/i40e_rxtx.c | 10 +++++----- > > 1 file changed, 5 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/net/i40e/i40e_rxtx.c > > b/drivers/net/i40e/i40e_rxtx.c index 4d35d83..9c126a3 100644 > > --- a/drivers/net/i40e/i40e_rxtx.c > > +++ b/drivers/net/i40e/i40e_rxtx.c > > @@ -2592,14 +2592,14 @@ i40e_rx_queue_release_mbufs(struct > > i40e_rx_queue *rxq) { > > uint16_t i; > > > > - /* SSE Vector driver has a different way of releasing mbufs. */ > > - if (rxq->rx_using_sse) { > > - i40e_rx_queue_release_mbufs_vec(rxq); > > + if (!rxq || !rxq->sw_ring) { > > + PMD_DRV_LOG(DEBUG, "Pointer to rxq or sw_ring is NULL"); > > return; > > } > > >=20 > I can't see how you could ever trigger this. > i40e_rx_queue_release_mbufs() is called only called from places where rx= q is > guraanteed non NULL. >=20 > Are you sure Coverity isn't tell you that? Coverity just reported " Dereference before null check ", nothing else ther= e. The function was called several times in different places. It could be safe= r, in case somebody wrongly give the queue id. But you are right, it shouldn't happen if nothing wrong. Are you suggesting to remove rxq check? Thanks! Regards, Helin