From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 802299AD2 for ; Wed, 25 Feb 2015 01:57:29 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP; 24 Feb 2015 16:57:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,642,1418112000"; d="scan'208";a="532398823" Received: from pgsmsx107.gar.corp.intel.com ([10.221.44.105]) by orsmga003.jf.intel.com with ESMTP; 24 Feb 2015 16:48:21 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by PGSMSX107.gar.corp.intel.com (10.221.44.105) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 25 Feb 2015 08:57:25 +0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.62]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.161]) with mapi id 14.03.0195.001; Wed, 25 Feb 2015 08:57:24 +0800 From: "Liang, Cunming" To: "John W. Linville" , Thomas Monjalon Thread-Topic: [dpdk-dev] [PATCH v1] afpacket: fix critical issue reported by klocwork Thread-Index: AQHQRqNwhvSBMF7XLES/6hu6NA5kfZz42iyAgACLZQCABzieEA== Date: Wed, 25 Feb 2015 00:57:23 +0000 Message-ID: References: <1423732089-6202-1-git-send-email-cunming.liang@intel.com> <2419026.Gth2S3iYAQ@xps13> <20150220183854.GA4179@tuxdriver.com> In-Reply-To: <20150220183854.GA4179@tuxdriver.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "dev@dpdk.org" , John Linville Subject: Re: [dpdk-dev] [PATCH v1] afpacket: fix critical issue reported by klocwork 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: Wed, 25 Feb 2015 00:57:29 -0000 > -----Original Message----- > From: John W. Linville [mailto:linville@tuxdriver.com] > Sent: Saturday, February 21, 2015 2:39 AM > To: Thomas Monjalon > Cc: Liang, Cunming; dev@dpdk.org; John Linville > Subject: Re: [dpdk-dev] [PATCH v1] afpacket: fix critical issue reported = by > klocwork >=20 > On Fri, Feb 20, 2015 at 11:19:59AM +0100, Thomas Monjalon wrote: > > Hi Cunming, > > > > You would have more chance to have a review by CC'ing John. > > I checked your patch and have a comment below. > > > > 2015-02-12 17:08, Cunming Liang: > > > Klocwork report 'req' might be used uninitialized. > > > In some cases it can 'goto error' when '*internals' not been set. > > > The result is unexpected checking the value of '*internals'. > > > > > > Signed-off-by: Cunming Liang > > > --- > > > lib/librte_pmd_af_packet/rte_eth_af_packet.c | 4 +++- > > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > > > diff --git a/lib/librte_pmd_af_packet/rte_eth_af_packet.c > b/lib/librte_pmd_af_packet/rte_eth_af_packet.c > > > index 1ffe1cd..185607d 100644 > > > --- a/lib/librte_pmd_af_packet/rte_eth_af_packet.c > > > +++ b/lib/librte_pmd_af_packet/rte_eth_af_packet.c > > > @@ -439,13 +439,15 @@ rte_pmd_init_internals(const char *name, > > > size_t ifnamelen; > > > unsigned k_idx; > > > struct sockaddr_ll sockaddr; > > > - struct tpacket_req *req; > > > + struct tpacket_req *req =3D NULL; > > > > If *internals is set to NULL, there should be no case where req used > > and undefined. [LCM] Agree, so that's why I add '*internals =3D NULL' below as well. >=20 > I agree -- it looks to me like req is protected by checking for > *internals =3D=3D NULL. I don't think this patch is necessary. [LCM] The major piece of the patch is add setting for '*internals=3DNULL;'. >=20 > > > struct pkt_rx_queue *rx_queue; > > > struct pkt_tx_queue *tx_queue; > > > int rc, qsockfd, tpver, discard; > > > unsigned int i, q, rdsize; > > > int fanout_arg __rte_unused, bypass __rte_unused; > > > > > > + *internals =3D NULL; > > > + > > > for (k_idx =3D 0; k_idx < kvlist->count; k_idx++) { > > > pair =3D &kvlist->pairs[k_idx]; > > > if (strstr(pair->key, ETH_AF_PACKET_IFACE_ARG) !=3D NULL) > > > > > > > > > > > >=20 > -- > John W. Linville Someday the world will need a hero, and you > linville@tuxdriver.com might be all we have. Be ready.