fix endianess when changing memory with balloon.
PATCH 1/1 fix endianess when changing memory with balloon.
Signed-off-by Victor Toso <[email protected]>
--- hw/virtio-balloon.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
hw/virtio-balloon.c +4 -1
@@ -193,12 +193,15 @@ static void virtio_balloon_stat(void *opaque, BalloonInfo *info)static void virtio_balloon_to_target (void *opaque,ram_addr_t target) {VirtIOBalloon *dev = opaque; +uint32_t num_pages;if (target > ram_size) { target = ram_size; }if (target) { - dev->num_pages = (ram_size - target) >>VIRTIO_BALLOON_PFN_SHIFT ; + num_pages = (ram_size - target) >>VIRTIO_BALLOON_PFN_SHIFT ; + dev->num_pages =virtio_is_big_endian () ? +cpu_to_be32 (num_pages):cpu_to_le32 (num_pages);virtio_notify_config (&dev->vdev); } }
Signature · 1 line
1.7.12.1