From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.tuxdriver.com (charlotte.tuxdriver.com [70.61.120.58]) by dpdk.org (Postfix) with ESMTP id 8D3B4B793 for ; Fri, 20 Feb 2015 19:45:13 +0100 (CET) Received: from uucp by smtp.tuxdriver.com with local-rmail (Exim 4.63) (envelope-from ) id 1YOsZb-00054s-Me; Fri, 20 Feb 2015 13:45:11 -0500 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.14.9/8.14.6) with ESMTP id t1KIctBm006469; Fri, 20 Feb 2015 13:38:55 -0500 Received: (from linville@localhost) by localhost.localdomain (8.14.9/8.14.9/Submit) id t1KIcskt006468; Fri, 20 Feb 2015 13:38:54 -0500 Date: Fri, 20 Feb 2015 13:38:54 -0500 From: "John W. Linville" To: Thomas Monjalon Message-ID: <20150220183854.GA4179@tuxdriver.com> References: <1423732089-6202-1-git-send-email-cunming.liang@intel.com> <2419026.Gth2S3iYAQ@xps13> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2419026.Gth2S3iYAQ@xps13> User-Agent: Mutt/1.5.23 (2014-03-12) 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: Fri, 20 Feb 2015 18:45:13 -0000 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 = NULL; > > If *internals is set to NULL, there should be no case where req used > and undefined. I agree -- it looks to me like req is protected by checking for *internals == NULL. I don't think this patch is necessary. > > 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 = NULL; > > + > > for (k_idx = 0; k_idx < kvlist->count; k_idx++) { > > pair = &kvlist->pairs[k_idx]; > > if (strstr(pair->key, ETH_AF_PACKET_IFACE_ARG) != NULL) > > > > > > -- John W. Linville Someday the world will need a hero, and you linville@tuxdriver.com might be all we have. Be ready.