qemu-patch-raspberry4/hw/virtio
Luiz Capitulino dcc6ceffc0 virtio-balloon: fix integer overflow in BALLOON_CHANGE QMP event
Because dev->actual is uint32_t, the expression 'dev->actual <<
VIRTIO_BALLOON_PFN_SHIFT' is truncated to 32 bits. This overflows when
dev->actual >= 1048576.

To reproduce:

 1. Start a VM with a QMP socket and 5G of RAM
 2. Connect to the QMP socket, negotiate capabilities and issue:

   { "execute":"balloon", "arguments": { "value": 1073741824 } }

 3. Watch for BALLOON_CHANGE QMP events, the last one will incorretly be:

   { "timestamp": { "seconds": 1366228965, "microseconds": 245466 },
     "event": "BALLOON_CHANGE", "data": { "actual": 5368709120 } }

To fix it this commit casts it to ram_addr_t, which is ram_size's type.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2013-04-19 08:32:44 -04:00
..
dataplane hw: move virtio devices to hw/ subdirectories 2013-04-08 18:13:12 +02:00
Makefile.objs hw: move virtio devices to hw/ subdirectories 2013-04-08 18:13:12 +02:00
vhost.c hw: move virtio devices to hw/ subdirectories 2013-04-08 18:13:12 +02:00
virtio-balloon.c virtio-balloon: fix integer overflow in BALLOON_CHANGE QMP event 2013-04-19 08:32:44 -04:00
virtio-bus.c hw: move target-independent files to subdirectories 2013-04-08 18:13:12 +02:00
virtio-pci.c virtio-net-pci: switch to the new API. 2013-04-17 10:28:58 -05:00
virtio-pci.h virtio-net-pci: switch to the new API. 2013-04-17 10:28:58 -05:00
virtio-rng.c sysemu: avoid proliferation of include/ subdirectories 2013-04-15 18:19:25 +02:00
virtio.c hw: move virtio devices to hw/ subdirectories 2013-04-08 18:13:12 +02:00