This error is seen in build of type "minsize":
drivers/net/pcap/pcap_ethdev.c:286:33: error:
'pcap_buf' may be used uninitialized [-Werror=maybe-uninitialized]
drivers/net/pcap/pcap_ethdev.c:1141:17: error:
'bufs' may be used uninitialized [-Werror=maybe-uninitialized]
It looks to be a compiler issue because the ring dequeue status
is checked before the mbuf pointers are used.
The variables are initialized to allow compiling with "minsize" option.
Fixes: a3f5252e5cbd ("net/pcap: enable infinitely Rx a pcap file")
Fixes: f62490e64d60 ("net/pcap: fix infinite Rx with large files")
Signed-off-by: Cheryl Bansal <[email protected]>
---
drivers/net/pcap/pcap_ethdev.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/pcap/pcap_ethdev.c b/drivers/net/pcap/pcap_ethdev.c
index 1e114e0008..671218e31c 100644
--- a/drivers/net/pcap/pcap_ethdev.c
+++ b/drivers/net/pcap/pcap_ethdev.c
@@ -277,7 +277,7 @@ eth_pcap_rx_infinite(void *queue, struct rte_mbuf **bufs,
uint16_t nb_pkts)
return 0;
for (i = 0; i < nb_pkts; i++) {
- struct rte_mbuf *pcap_buf;
+ struct rte_mbuf *pcap_buf = NULL;
int err = rte_ring_dequeue(pcap_q->pkts, (void **)&pcap_buf);
if (err)
return i;
@@ -1135,7 +1135,7 @@ eth_stats_reset(struct rte_eth_dev *dev)
static inline void
infinite_rx_ring_free(struct rte_ring *pkts)
{
- struct rte_mbuf *bufs;
+ struct rte_mbuf *bufs = NULL;
while (!rte_ring_dequeue(pkts, (void **)&bufs))
rte_pktmbuf_free(bufs);
--
2.43.0