Commit 14f9b664b34bbd37a488cb5c762aa278c60e1fb6 added a config_size field
to struct VirtIONet. However, struct VirtIONet has an embedded struct
VirtIODevice that already contains a config_len field for this purpose, so
config_size is unnecessary. This patch simply replaces it with
vdev->config_len instead.

Signed-off-by: Jesse Larrew <jlar...@linux.vnet.ibm.com>
---
 hw/virtio-net.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index 573c669..bdbfc18 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -73,7 +73,6 @@ typedef struct VirtIONet
     int multiqueue;
     uint16_t max_queues;
     uint16_t curr_queues;
-    size_t config_size;
 } VirtIONet;
 
 /*
@@ -127,7 +126,7 @@ static void virtio_net_get_config(VirtIODevice *vdev, 
uint8_t *config)
     stw_p(&netcfg.status, n->status);
     stw_p(&netcfg.max_virtqueue_pairs, n->max_queues);
     memcpy(netcfg.mac, n->mac, ETH_ALEN);
-    memcpy(config, &netcfg, n->config_size);
+    memcpy(config, &netcfg, vdev->config_len);
 }
 
 static void virtio_net_set_config(VirtIODevice *vdev, const uint8_t *config)
@@ -135,7 +134,7 @@ static void virtio_net_set_config(VirtIODevice *vdev, const 
uint8_t *config)
     VirtIONet *n = to_virtio_net(vdev);
     struct virtio_net_config netcfg = {};
 
-    memcpy(&netcfg, config, n->config_size);
+    memcpy(&netcfg, config, vdev->config_len);
 
     if (!(n->vdev.guest_features >> VIRTIO_NET_F_CTRL_MAC_ADDR & 1) &&
         memcmp(netcfg.mac, n->mac, ETH_ALEN)) {
@@ -1316,7 +1315,6 @@ VirtIODevice *virtio_net_init(DeviceState *dev, NICConf 
*conf,
     n = (VirtIONet *)virtio_common_init("virtio-net", VIRTIO_ID_NET,
                                         config_size, sizeof(VirtIONet));
 
-    n->config_size = config_size;
     n->vdev.get_config = virtio_net_get_config;
     n->vdev.set_config = virtio_net_set_config;
     n->vdev.get_features = virtio_net_get_features;
-- 
1.7.11.7


Reply via email to