DPDK patches and discussions
 help / color / mirror / Atom feed
From: Min Zhou <zhoumin@loongson.cn>
To: chenbo.xia@intel.com
Cc: dev@dpdk.org, maobibo@loongson.cn, zhoumin@loongson.cn
Subject: [PATCH v1] vhost: fix build
Date: Mon, 22 Aug 2022 15:42:33 +0800	[thread overview]
Message-ID: <20220822074233.209414-1-zhoumin@loongson.cn> (raw)

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


             reply	other threads:[~2022-08-22  7:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-22  7:42 Min Zhou [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220822074233.209414-1-zhoumin@loongson.cn \
    --to=zhoumin@loongson.cn \
    --cc=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=maobibo@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).