qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] net: virtio-net: initialise local 'netcfg' vari


From: Jason Wang
Subject: Re: [Qemu-devel] [PATCH] net: virtio-net: initialise local 'netcfg' variable
Date: Mon, 5 Dec 2016 15:48:22 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1



On 2016年12月02日 19:28, P J P wrote:
From: Prasad J Pandit <address@hidden>

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 <address@hidden>
Signed-off-by: Prasad J Pandit <address@hidden>
---
  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);

Good catch but since mtu patch wasn't accepted so mtu were in fact not exposed to guest.

(FYI, you can have a look at Maxime patch, he did a stw_p here()).

Thanks



reply via email to

[Prev in Thread] Current Thread [Next in Thread]