From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:46912) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QmJub-0002BN-OO for qemu-devel@nongnu.org; Thu, 28 Jul 2011 02:17:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QmJua-0006RN-Lj for qemu-devel@nongnu.org; Thu, 28 Jul 2011 02:17:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:5744) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QmJua-0006RI-CH for qemu-devel@nongnu.org; Thu, 28 Jul 2011 02:17:36 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p6S6HZ5m010017 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 28 Jul 2011 02:17:35 -0400 From: Amit Shah Date: Thu, 28 Jul 2011 11:47:14 +0530 Message-Id: In-Reply-To: References: In-Reply-To: References: Subject: [Qemu-devel] [PATCH v2 3/5] balloon: Ignore negative balloon values List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu list Cc: Amit Shah , Markus Armbruster , "Michael S. Tsirkin" Negative balloon values don't make sense, ignore them. Reported-by: Mike Cao Signed-off-by: Amit Shah --- balloon.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/balloon.c b/balloon.c index 5200565..f56fdc1 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; -- 1.7.6