patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 1/2] vhost: fix accessing uninitialized variables
@ 2021-04-07  3:25 Marvin Liu
  2021-04-07  3:25 ` [dpdk-stable] [PATCH 2/2] vhost: fix async enqueue " Marvin Liu
  2021-04-07  6:53 ` [dpdk-stable] [PATCH 1/2] vhost: fix " Xia, Chenbo
  0 siblings, 2 replies; 4+ messages in thread
From: Marvin Liu @ 2021-04-07  3:25 UTC (permalink / raw)
  To: maxime.coquelin, chenbo.xia; +Cc: dev, Marvin Liu, stable

This patch fixs coverity issue by adding initialization step before
using temporary virtio header.

Coverity issue: 366181
Fixes: fb3815cc614d ("vhost: handle virtually non-contiguous buffers in Rx-mrg")
Cc: stable@dpdk.org

Signed-off-by: Marvin Liu <yong.liu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
index 7f621fb6dd..48b013a9b4 100644
--- a/lib/librte_vhost/virtio_net.c
+++ b/lib/librte_vhost/virtio_net.c
@@ -812,9 +812,10 @@ copy_mbuf_to_desc(struct virtio_net *dev, struct vhost_virtqueue *vq,
 
 	hdr_mbuf = m;
 	hdr_addr = buf_addr;
-	if (unlikely(buf_len < dev->vhost_hlen))
+	if (unlikely(buf_len < dev->vhost_hlen)) {
+		memset(&tmp_hdr, 0, sizeof(struct virtio_net_hdr_mrg_rxbuf));
 		hdr = &tmp_hdr;
-	else
+	} else
 		hdr = (struct virtio_net_hdr_mrg_rxbuf *)(uintptr_t)hdr_addr;
 
 	VHOST_LOG_DATA(DEBUG, "(%d) RX: num merge buffers %d\n",
-- 
2.17.1


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

end of thread, other threads:[~2021-04-07  6:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-07  3:25 [dpdk-stable] [PATCH 1/2] vhost: fix accessing uninitialized variables Marvin Liu
2021-04-07  3:25 ` [dpdk-stable] [PATCH 2/2] vhost: fix async enqueue " Marvin Liu
2021-04-07  6:14   ` Xia, Chenbo
2021-04-07  6:53 ` [dpdk-stable] [PATCH 1/2] vhost: fix " Xia, Chenbo

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