Skip to contentSkip to conversation

vhost-vdpa :Fix Coverity CID 1430270 / CID 1420267

PATCH Superseded Cindy Lu 1 participant 1 message Jul 10, 2020

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Cindy Lu

author
#0 lore raw

PATCH 1/1 vhost-vdpa :Fix Coverity CID 1430270 / CID 1420267

In the function鑱絭host_vdpa_dma_map/unmap, The鑱絪truct msg鑱絯as not鑱絠nitialized all its fields.

---
 hw/virtio/vhost-vdpa.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/virtio/vhost-vdpa.c +2 -2
index a3d17fe0f9..b9265f3761 100644
@@ -38,7 +38,7 @@ static bool vhost_vdpa_listener_skipped_section(MemoryRegionSection *section)
 static int vhost_vdpa_dma_map(struct vhost_vdpa *v, hwaddr iova, hwaddr size,
                               void *vaddr, bool readonly)
 {
-    struct vhost_msg_v2 msg;
+    struct vhost_msg_v2 msg = {};
     int fd = v->device_fd;
     int ret = 0;
 
@@ -61,7 +61,7 @@ static int vhost_vdpa_dma_map(struct vhost_vdpa *v, hwaddr iova, hwaddr size,
 static int vhost_vdpa_dma_unmap(struct vhost_vdpa *v, hwaddr iova,
                                 hwaddr size)
 {
-    struct vhost_msg_v2 msg;
+    struct vhost_msg_v2 msg = {};
     int fd = v->device_fd;
     int ret = 0;
 
Signature · 1 line
2.21.1