aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2012-08-29 19:03:09 +0200
committerJuan Quintela <quintela@redhat.com>2012-10-17 18:34:59 +0200
commite398d61b4777125f32a99fa49519c5edbb00809b (patch)
tree67301b1a0cc6a97f612beced3407722dce06aa45
parentffbfc74d1eb822ed086503a6c24413617c19d31a (diff)
virtio-net: use qemu_get_buffer() in a temp buffer
qemu_fseek() is known to be wrong. Would be removed on the next commit. This code should never been used (value has been MAC_TABLE_ENTRIES since 2009). Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--hw/virtio-net.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index 8342391d90..50ba728c02 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -921,7 +921,9 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
qemu_get_buffer(f, n->mac_table.macs,
n->mac_table.in_use * ETH_ALEN);
} else if (n->mac_table.in_use) {
- qemu_fseek(f, n->mac_table.in_use * ETH_ALEN, SEEK_CUR);
+ uint8_t *buf = g_malloc0(n->mac_table.in_use);
+ qemu_get_buffer(f, buf, n->mac_table.in_use * ETH_ALEN);
+ g_free(buf);
n->mac_table.multi_overflow = n->mac_table.uni_overflow = 1;
n->mac_table.in_use = 0;
}