]> git.ipfire.org Git - thirdparty/qemu.git/commit
virtio_serial: Don't use vser->config.max_nr_ports internally
authorDavid Gibson <david@gibson.dropbear.id.au>
Fri, 19 Dec 2014 03:57:26 +0000 (14:57 +1100)
committerAmit Shah <amit.shah@redhat.com>
Mon, 5 Jan 2015 07:19:58 +0000 (12:49 +0530)
commitf2f6e00b2e27b65edaa6ce5cb01770c973cbf8fb
tree7b9992d48fcc6917118ff0814ac98bf578a700ad
parentab0302ee764fd702465aef6d88612cdff4302809
virtio_serial: Don't use vser->config.max_nr_ports internally

A number of places in the virtio_serial driver retrieve the number of ports
from vser->config.max_nr_ports, which is guest-endian.  But for internal
users, we already have a host-endian copy of the number of ports in
vser->serial.max_virtserial_ports.  Using that instead of the config field
removes the need for easy-to-forget byteswapping.

In particular this fixes a bug on incoming migration, where we don't adjust
the endianness vser->config correctly, because it hasn't yet been loaded
from the migration stream when virtio_serial_load_device() is called.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
hw/char/virtio-serial-bus.c