From: Prasad J Pandit <p...@fedoraproject.org>

Local 'netcfg' variable in 'virtio_net_get_config' routine was
not initialised. It could leak uninitialised 'netcfg.mtu' field
memory. Initialise 'netcfg' to avoid it.

Reported-by: Azureyang <azurey...@tencent.com>
Signed-off-by: Prasad J Pandit <p...@fedoraproject.org>
---
 hw/net/virtio-net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 01f1351..cb5b3dc 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -72,7 +72,7 @@ static int vq2q(int queue_index)
 static void virtio_net_get_config(VirtIODevice *vdev, uint8_t *config)
 {
     VirtIONet *n = VIRTIO_NET(vdev);
-    struct virtio_net_config netcfg;
+    struct virtio_net_config netcfg = {};
 
     virtio_stw_p(vdev, &netcfg.status, n->status);
     virtio_stw_p(vdev, &netcfg.max_virtqueue_pairs, n->max_queues);
-- 
2.7.4


Reply via email to