aboutsummaryrefslogtreecommitdiff
path: root/balloon.c
diff options
context:
space:
mode:
Diffstat (limited to 'balloon.c')
-rw-r--r--balloon.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/balloon.c b/balloon.c
index 5200565cb2..f56fdc1c4b 100644
--- a/balloon.c
+++ b/balloon.c
@@ -140,6 +140,7 @@ int do_info_balloon(Monitor *mon, MonitorCompletion cb, void *opaque)
int do_balloon(Monitor *mon, const QDict *params,
MonitorCompletion cb, void *opaque)
{
+ int64_t target;
int ret;
if (kvm_enabled() && !kvm_has_sync_mmu()) {
@@ -147,7 +148,12 @@ int do_balloon(Monitor *mon, const QDict *params,
return -1;
}
- ret = qemu_balloon(qdict_get_int(params, "value"));
+ target = qdict_get_int(params, "value");
+ if (target <= 0) {
+ qerror_report(QERR_INVALID_PARAMETER_VALUE, "target", "a size");
+ return -1;
+ }
+ ret = qemu_balloon(target);
if (ret == 0) {
qerror_report(QERR_DEVICE_NOT_ACTIVE, "balloon");
return -1;