]> git.ipfire.org Git - thirdparty/qemu.git/commit
virtio-balloon: fix integer overflow in memory stats feature
authorLuiz Capitulino <lcapitulino@redhat.com>
Mon, 15 Sep 2014 16:00:11 +0000 (12:00 -0400)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 6 Jan 2015 02:18:58 +0000 (20:18 -0600)
commitd754428b9bf9aba4b040aca89e95eb30e5d59faa
tree1675a39048f6feb4c1a1d54abc0a2c363d6f6c84
parent5d350980f6d6747adfbac4005044e75623c510af
virtio-balloon: fix integer overflow in memory stats feature

When a QMP client changes the polling interval time by setting
the guest-stats-polling-interval property, the interval value
is stored and manipulated as an int64_t variable.

However, the balloon_stats_change_timer() function, which is
used to set the actual timer with the interval value, takes
an int instead, causing an overflow for big interval values.

This commit fix this bug by changing balloon_stats_change_timer()
to take an int64_t and also it limits the polling interval value
to UINT_MAX to avoid other kinds of overflow.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
(cherry picked from commit 1f9296b51a26650916a2c4191268bb64057bdc5f)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/virtio/virtio-balloon.c