From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-f49.google.com (mail-wg0-f49.google.com [74.125.82.49]) by dpdk.org (Postfix) with ESMTP id AEDDDB555 for ; Fri, 20 Feb 2015 11:20:29 +0100 (CET) Received: by mail-wg0-f49.google.com with SMTP id l18so12239402wgh.8 for ; Fri, 20 Feb 2015 02:20:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type; bh=9moQZ6yLX2p1cxfEi8rhiArnvCy7R46eC/YUqpmzXs0=; b=cPOrn0juAxRq++MRUcI5sZPnzPYCvClSUXwaYytmbU+jYY5XQ7bSOv/sNen/nPHk7Q qSd/eLwRCC6Oir3oMemf7hU+WA2NuL7Z/iccMLscms1rX1yW7s6h35RwRIYU4/FVb+4i zoGfy7KYEIVzvG4hJjiDbIg7Tb20e0HIuGoP+MMamz76s1hsE+/LZ9l9hp6Fi1cGuLP1 o+QkSS7LtEos75cWOaNX7aICjFMGqk57af1LqoTICP5LrvhqxlYQobwtSnp4QB6UMp5O jw6KqI3eIT8eUik1tPy1DFAhBa11XLHhMnr1/S/nD6McKPqXANTwkupQxkBt4sewdBg/ uCzA== X-Gm-Message-State: ALoCoQnLGd9ueVX9TwG17WYytBysjCFCvYpSrM+gwIt2rB41QJqlimx4QeX0+fzd84NpyDyH5Ezc X-Received: by 10.194.20.67 with SMTP id l3mr17292240wje.94.1424427629514; Fri, 20 Feb 2015 02:20:29 -0800 (PST) Received: from xps13.localnet (136-92-190-109.dsl.ovh.fr. [109.190.92.136]) by mx.google.com with ESMTPSA id hm6sm41386295wjb.32.2015.02.20.02.20.28 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Feb 2015 02:20:28 -0800 (PST) From: Thomas Monjalon To: Cunming Liang Date: Fri, 20 Feb 2015 11:19:59 +0100 Message-ID: <2419026.Gth2S3iYAQ@xps13> Organization: 6WIND User-Agent: KMail/4.14.4 (Linux/3.18.4-1-ARCH; KDE/4.14.4; x86_64; ; ) In-Reply-To: <1423732089-6202-1-git-send-email-cunming.liang@intel.com> References: <1423732089-6202-1-git-send-email-cunming.liang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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 10:20:29 -0000 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. > 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) >