DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v1] afpacket: fix critical issue reported by klocwork
@ 2015-02-12  9:08 Cunming Liang
  2015-02-20 10:19 ` Thomas Monjalon
  0 siblings, 1 reply; 6+ messages in thread
From: Cunming Liang @ 2015-02-12  9:08 UTC (permalink / raw)
  To: dev

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 <cunming.liang@intel.com>
---
 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;
 	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)
-- 
1.8.1.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-02-25  9:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-12  9:08 [dpdk-dev] [PATCH v1] afpacket: fix critical issue reported by klocwork Cunming Liang
2015-02-20 10:19 ` Thomas Monjalon
2015-02-20 18:38   ` John W. Linville
2015-02-25  0:57     ` Liang, Cunming
2015-02-25  8:45       ` Thomas Monjalon
2015-02-25  9:52         ` Liang, Cunming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).