Skip to contentSkip to conversation

vhost: fix uninitialized local variable

PATCH Applied Patrick Fu 2 participants 3 messages Oct 27, 2020 – Oct 29, 2020

lore
Share & tools
lore

Patrick Fu

author
#0 lore raw

PATCH 1/1 vhost: fix uninitialized local variable

This patch initializes a local parameter in async data path to avoid compiler warnings.

Fixes cd6760da1076 ("vhost: introduce async enqueue for split ring")
---
 lib/librte_vhost/virtio_net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/librte_vhost/virtio_net.c +1 -1
index 030795645..10dec5e54 100644
@@ -1491,7 +1491,7 @@ virtio_dev_rx_async_submit_split(struct virtio_net *dev,
 	struct iovec *dst_iovec = vec_pool + (VHOST_MAX_ASYNC_VEC >> 1);
 	struct rte_vhost_iov_iter *src_it = it_pool;
 	struct rte_vhost_iov_iter *dst_it = it_pool + 1;
-	uint16_t n_free_slot, slot_idx;
+	uint16_t n_free_slot, slot_idx = 0;
 	uint16_t pkt_err = 0;
 	uint16_t segs_await = 0;
 	struct async_inflight_info *pkts_info = vq->async_pkts_info;
Signature · 1 line
2.18.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Patrick Fu

This patch initializes a local parameter in async data path to avoid compiler warnings.

Fixes cd6760da1076 ("vhost: introduce async enqueue for split ring")
---
 lib/librte_vhost/virtio_net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/librte_vhost/virtio_net.c +0 -0
index 030795645..10dec5e54 100644

lib/librte_vhost/virtio_net.c virtio_dev_rx_async_submit_split(struct virtio_net *dev, · line 1497

Quoted 8 lines
lib/librte_vhost/virtio_net.c +1 -1
@@ -1491,7 +1491,7 @@ virtio_dev_rx_async_submit_split(struct virtio_net *dev,
 	struct iovec *dst_iovec = vec_pool + (VHOST_MAX_ASYNC_VEC >> 1);
 	struct rte_vhost_iov_iter *src_it = it_pool;
 	struct rte_vhost_iov_iter *dst_it = it_pool + 1;
-	uint16_t n_free_slot, slot_idx;
+	uint16_t n_free_slot, slot_idx = 0;
 	uint16_t pkt_err = 0;
 	uint16_t segs_await = 0;
 	struct async_inflight_info *pkts_info = vq->async_pkts_info;

Thanks,
Maxime

#2 lore raw
In reply to Patrick Fu
Quoted 10 lines · Patrick Fu

This patch initializes a local parameter in async data path to avoid compiler warnings.

Fixes cd6760da1076 ("vhost: introduce async enqueue for split ring")
---
 lib/librte_vhost/virtio_net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to dpdk-next-virtio/main.

Thanks!
Maxime