linux/drivers/virtio
Arnd Bergmann 3b5d8b0478 virtio_balloon: prevent uninitialized variable use
commit f0bb2d50df upstream.

The latest gcc-7.0.1 snapshot reports a new warning:

virtio/virtio_balloon.c: In function 'update_balloon_stats':
virtio/virtio_balloon.c:258:26: error: 'events[2]' is used uninitialized in this function [-Werror=uninitialized]
virtio/virtio_balloon.c:260:26: error: 'events[3]' is used uninitialized in this function [-Werror=uninitialized]
virtio/virtio_balloon.c:261:56: error: 'events[18]' is used uninitialized in this function [-Werror=uninitialized]
virtio/virtio_balloon.c:262:56: error: 'events[17]' is used uninitialized in this function [-Werror=uninitialized]

This seems absolutely right, so we should add an extra check to
prevent copying uninitialized stack data into the statistics.
>From all I can tell, this has been broken since the statistics code
was originally added in 2.6.34.

Fixes: 9564e138b1 ("virtio: Add memory statistics reporting to the balloon driver (V4)")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Ladi Prosek <lprosek@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
History 2017-07-18 18:40:24 +01:00
..
config.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
Kconfig drivers/virtio: remove depends on CONFIG_EXPERIMENTAL 2013-01-11 11:39:04 -08:00
Makefile virtio: remove CONFIG_VIRTIO_RING 2012-09-28 15:05:15 +09:30
virtio.c virtio: fix memory leak of virtio ida cache layers 2016-01-11 10:50:18 +00:00
virtio_balloon.c virtio_balloon: prevent uninitialized variable use 2017-07-18 18:40:24 +01:00
virtio_mmio.c virtio: mmio: fix signature checking for BE guests 2013-11-07 12:13:04 +10:30
virtio_pci.c virtio_pci: fix use after free on release 2016-02-17 10:22:39 +00:00
virtio_ring.c virtio: virtio_break_device() to mark all virtqueues broken. 2014-04-28 11:34:13 +09:30