All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH-for-5.2] hw/virtio/vhost-vdpa: Fix Coverity CID 1432864
@ 2020-10-28 15:40 Philippe Mathieu-Daudé
  2020-11-02 17:31 ` Peter Maydell
  0 siblings, 1 reply; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-28 15:40 UTC (permalink / raw
  To: qemu-devel
  Cc: Jason Wang, Philippe Mathieu-Daudé, Cindy Lu,
	Michael S. Tsirkin

Fix uninitialized value issues reported by Coverity:

  Field 'msg.reserved' is uninitialized when calling write().

Fixes: a5bd05800f8 ("vhost-vdpa: batch updating IOTLB mappings")
Reported-by: Coverity (CID 1432864: UNINIT)
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Cc: Cindy Lu <lulu@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
---
 hw/virtio/vhost-vdpa.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
index 4f1039910af..01d2101d097 100644
--- a/hw/virtio/vhost-vdpa.c
+++ b/hw/virtio/vhost-vdpa.c
@@ -90,7 +90,7 @@ static void vhost_vdpa_listener_begin(MemoryListener *listener)
 {
     struct vhost_vdpa *v = container_of(listener, struct vhost_vdpa, listener);
     struct vhost_dev *dev = v->dev;
-    struct vhost_msg_v2 msg;
+    struct vhost_msg_v2 msg = {};
     int fd = v->device_fd;
 
     if (!(dev->backend_cap & (0x1ULL << VHOST_BACKEND_F_IOTLB_BATCH))) {
@@ -110,7 +110,7 @@ static void vhost_vdpa_listener_commit(MemoryListener *listener)
 {
     struct vhost_vdpa *v = container_of(listener, struct vhost_vdpa, listener);
     struct vhost_dev *dev = v->dev;
-    struct vhost_msg_v2 msg;
+    struct vhost_msg_v2 msg = {};
     int fd = v->device_fd;
 
     if (!(dev->backend_cap & (0x1ULL << VHOST_BACKEND_F_IOTLB_BATCH))) {
-- 
2.26.2



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

* Re: [PATCH-for-5.2] hw/virtio/vhost-vdpa: Fix Coverity CID 1432864
  2020-10-28 15:40 [PATCH-for-5.2] hw/virtio/vhost-vdpa: Fix Coverity CID 1432864 Philippe Mathieu-Daudé
@ 2020-11-02 17:31 ` Peter Maydell
  2020-11-02 18:52   ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2020-11-02 17:31 UTC (permalink / raw
  To: Philippe Mathieu-Daudé
  Cc: Jason Wang, QEMU Developers, Cindy Lu, Michael S. Tsirkin

On Wed, 28 Oct 2020 at 15:45, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>
> Fix uninitialized value issues reported by Coverity:
>
>   Field 'msg.reserved' is uninitialized when calling write().
>
> Fixes: a5bd05800f8 ("vhost-vdpa: batch updating IOTLB mappings")
> Reported-by: Coverity (CID 1432864: UNINIT)
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Hi Philippe; thanks for this patch. I don't suppose you
could also write a patch that fixes the same problem in
vhost_kernel_send_device_iotlb_msg() (CID 1432871) ?

thanks
-- PMM


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

* Re: [PATCH-for-5.2] hw/virtio/vhost-vdpa: Fix Coverity CID 1432864
  2020-11-02 17:31 ` Peter Maydell
@ 2020-11-02 18:52   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-11-02 18:52 UTC (permalink / raw
  To: Peter Maydell; +Cc: Jason Wang, QEMU Developers, Cindy Lu, Michael S. Tsirkin

On 11/2/20 6:31 PM, Peter Maydell wrote:
> On Wed, 28 Oct 2020 at 15:45, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>>
>> Fix uninitialized value issues reported by Coverity:
>>
>>   Field 'msg.reserved' is uninitialized when calling write().
>>
>> Fixes: a5bd05800f8 ("vhost-vdpa: batch updating IOTLB mappings")
>> Reported-by: Coverity (CID 1432864: UNINIT)
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> 
> Hi Philippe; thanks for this patch. I don't suppose you
> could also write a patch that fixes the same problem in
> vhost_kernel_send_device_iotlb_msg() (CID 1432871) ?

Oh I hadn't noticed it, sure, no problem!



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

end of thread, other threads:[~2020-11-02 18:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-28 15:40 [PATCH-for-5.2] hw/virtio/vhost-vdpa: Fix Coverity CID 1432864 Philippe Mathieu-Daudé
2020-11-02 17:31 ` Peter Maydell
2020-11-02 18:52   ` Philippe Mathieu-Daudé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.