From: Amit Shah <amit.shah@redhat.com>
To: qemu list <qemu-devel@nongnu.org>
Cc: Amit Shah <amit.shah@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
Luiz Capitulino <lcapitulino@redhat.com>
Subject: [Qemu-devel] [PATCH 1/1] balloon: Ignore negative balloon values
Date: Wed, 27 Jul 2011 17:25:41 +0530 [thread overview]
Message-ID: <fb259790d26f17727d690dfa3bcc73fb2c2fd158.1311766038.git.amit.shah@redhat.com> (raw)
Negative balloon values don't make sense, ignore them.
Reported-by: Mike Cao <bcao@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
I'm not sure if error_report is the right thing to use or should a new
qerror_report() be used. Luiz, comments?
balloon.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/balloon.c b/balloon.c
index cf9e3b2..e0ff97f 100644
--- a/balloon.c
+++ b/balloon.c
@@ -51,12 +51,16 @@ int qemu_add_balloon_handler(QEMUBalloonEvent *event_func,
return 0;
}
-static int qemu_balloon(ram_addr_t target)
+static int qemu_balloon(long long target)
{
if (!balloon_event_fn) {
return 0;
}
trace_balloon_event(balloon_opaque, target);
+ if (target < 0) {
+ error_report("Ignoring negative balloon value");
+ return -1;
+ }
balloon_event_fn(balloon_opaque, target);
return 1;
}
@@ -150,6 +154,8 @@ int do_balloon(Monitor *mon, const QDict *params,
if (ret == 0) {
qerror_report(QERR_DEVICE_NOT_ACTIVE, "balloon");
return -1;
+ } else if (ret < 0) {
+ return -1;
}
cb(opaque, NULL);
--
1.7.6
next reply other threads:[~2011-07-27 11:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-27 11:55 Amit Shah [this message]
2011-07-27 13:49 ` [Qemu-devel] [PATCH 1/1] balloon: Ignore negative balloon values Markus Armbruster
2011-07-28 4:40 ` Amit Shah
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fb259790d26f17727d690dfa3bcc73fb2c2fd158.1311766038.git.amit.shah@redhat.com \
--to=amit.shah@redhat.com \
--cc=armbru@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).