DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v1] vhost: fix build
@ 2022-08-22  7:42 Min Zhou
  2022-08-24  0:45 ` zhoumin
  2022-08-24 14:09 ` David Marchand
  0 siblings, 2 replies; 5+ messages in thread
From: Min Zhou @ 2022-08-22  7:42 UTC (permalink / raw)
  To: chenbo.xia; +Cc: dev, maobibo, zhoumin

This patch fixes the following build failure seen on CentOS 8
with gcc 12.1 because of uninitialized struct variable:

  [..]
../lib/vhost/virtio_net.c:1159:18: warning: 'buf_vec[0].buf_addr' may be used uninitialized [-Wmaybe-uninitialized]
1159 |         buf_addr = buf_vec[vec_idx].buf_addr;
     |         ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
  [..]

Fixes: 873e8dad6f49 ("vhost: support packed ring in async datapath")

Signed-off-by: Min Zhou <zhoumin@loongson.cn>
---
 lib/vhost/virtio_net.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c
index 35fa4670fd..4878bb2d8a 100644
--- a/lib/vhost/virtio_net.c
+++ b/lib/vhost/virtio_net.c
@@ -1837,6 +1837,7 @@ virtio_dev_rx_async_packed(struct virtio_net *dev, struct vhost_virtqueue *vq,
 {
 	struct buf_vector buf_vec[BUF_VECTOR_MAX];
 
+	memset(buf_vec, 0, sizeof(buf_vec));
 	if (unlikely(vhost_enqueue_async_packed(dev, vq, pkt, buf_vec,
 					nr_descs, nr_buffers) < 0)) {
 		VHOST_LOG_DATA(dev->ifname, DEBUG, "failed to get enough desc from vring\n");
-- 
2.31.1


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

end of thread, other threads:[~2022-08-25 14:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-22  7:42 [PATCH v1] vhost: fix build Min Zhou
2022-08-24  0:45 ` zhoumin
2022-08-24 14:09 ` David Marchand
2022-08-25 12:36   ` zhoumin
2022-08-25 14:08     ` David Marchand

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).