1
0
Fork 0
remarkable-linux/drivers/virtio
Arnd Bergmann bb011a4513 virtio_balloon: prevent uninitialized variable use
[ Upstream commit f0bb2d50df ]

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: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-25 14:23:42 +01:00
..
Kconfig virtio_ring: Support DMA APIs 2016-03-02 17:01:57 +02:00
Makefile Add virtio-input driver. 2015-03-29 12:13:52 +10:30
virtio.c virtio: release virtio index when fail to device_register 2017-12-14 09:28:10 +01:00
virtio_balloon.c virtio_balloon: prevent uninitialized variable use 2017-12-25 14:23:42 +01:00
virtio_input.c virtio: make find_vqs() checkpatch.pl-friendly 2016-01-12 20:47:06 +02:00
virtio_mmio.c virtio_mmio: Set DMA masks appropriately 2017-02-01 08:33:13 +01:00
virtio_pci_common.c PCI changes for the v4.6 merge window: 2016-03-16 14:45:55 -07:00
virtio_pci_common.h virtio_pci: Use the DMA API if enabled 2016-03-02 17:01:58 +02:00
virtio_pci_legacy.c virtio_pci: Limit DMA mask to 44 bits for legacy virtio devices 2016-10-31 00:21:39 +02:00
virtio_pci_modern.c virtio: virtio 1.0 cs04 spec compliance for reset 2016-04-07 15:16:39 +03:00
virtio_ring.c Revert "vring: Force use of DMA API for ARM-based systems with legacy devices" 2017-02-09 08:08:28 +01:00