summaryrefslogtreecommitdiffstats
path: root/include/qemu/throttle.h
diff options
context:
space:
mode:
authorFam Zheng <famz@redhat.com>2016-01-20 12:21:20 +0800
committerTimothy Pearson <tpearson@raptorengineering.com>2019-11-29 19:28:25 -0600
commit6aef5c511448e2f70efcf7a2074f6d469a479d63 (patch)
treed8e1d7aa924848f8a9b907402d6f6be77a8dfe87 /include/qemu/throttle.h
parent5e738770d10cfdc4aad2b34f5431a2d647616e9a (diff)
downloadhqemu-6aef5c511448e2f70efcf7a2074f6d469a479d63.zip
hqemu-6aef5c511448e2f70efcf7a2074f6d469a479d63.tar.gz
blockdev: Error out on negative throttling option values
extract_common_blockdev_options() uses qemu_opt_get_number() to parse the bps/iops numbers to uint64_t, then converts to double and stores in ThrottleConfig. The actual parsing is done by strtoull() in parse_option_number(). Negative numbers are wrapped to large positive ones, and stored. We used to reject negative numbers since 7d81c1413c9, but this regressed when the option parsing code was changed later. Now fix this again. This time, define an arbitrary large upper limit (1e15), and check the values so both negative and impractically big numbers are caught and reported. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'include/qemu/throttle.h')
-rw-r--r--include/qemu/throttle.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/qemu/throttle.h b/include/qemu/throttle.h
index 12faaad..d0c98ed 100644
--- a/include/qemu/throttle.h
+++ b/include/qemu/throttle.h
@@ -29,6 +29,8 @@
#include "qemu-common.h"
#include "qemu/timer.h"
+#define THROTTLE_VALUE_MAX 1000000000000000LL
+
typedef enum {
THROTTLE_BPS_TOTAL,
THROTTLE_BPS_READ,
OpenPOWER on IntegriCloud