From: Amit Shah <amit.shah@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu list <qemu-devel@nongnu.org>,
Amit Shah <amit.shah@redhat.com>,
Greg Kurz <gkurz@linux.vnet.ibm.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
Juan Quintela <quintela@redhat.com>
Subject: [Qemu-devel] [PULL 9/9] migration: fix bad string passed to error_report()
Date: Fri, 5 Feb 2016 19:26:54 +0530 [thread overview]
Message-ID: <15d61692da651fc79b3fc40050b986c5a73055c0.1454680535.git.amit.shah@redhat.com> (raw)
In-Reply-To: <cover.1454680535.git.amit.shah@redhat.com>
In-Reply-To: <cover.1454680535.git.amit.shah@redhat.com>
From: Greg Kurz <gkurz@linux.vnet.ibm.com>
state->name does not contain a terminating '\0' and you may get:
Machine type received is 'pseries-2.3y�?' and local is 'pseries-2.4'
load of migration failed: Invalid argument
Let's add a precision modifier to fix this.
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Message-Id: <20160205083201.2201.76109.stgit@bahia.huguette.org>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
migration/savevm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/migration/savevm.c b/migration/savevm.c
index 00be5fe..94f2894 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -299,8 +299,8 @@ static int configuration_post_load(void *opaque, int version_id)
const char *current_name = MACHINE_GET_CLASS(current_machine)->name;
if (strncmp(state->name, current_name, state->len) != 0) {
- error_report("Machine type received is '%s' and local is '%s'",
- state->name, current_name);
+ error_report("Machine type received is '%.*s' and local is '%s'",
+ (int) state->len, state->name, current_name);
return -EINVAL;
}
return 0;
--
2.5.0
next prev parent reply other threads:[~2016-02-05 13:57 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-05 13:56 [Qemu-devel] [PULL 0/9] migration: small fixes Amit Shah
2016-02-05 13:56 ` [Qemu-devel] [PULL 1/9] ram: Split host_from_stream_offset() into two helper functions Amit Shah
2016-02-05 13:56 ` [Qemu-devel] [PULL 2/9] migration: rename 'file' in MigrationState to 'to_dst_file' Amit Shah
2016-02-05 13:56 ` [Qemu-devel] [PULL 3/9] savevm: Split load vm state function qemu_loadvm_state Amit Shah
2016-02-05 13:56 ` [Qemu-devel] [PULL 4/9] migration/ram: Fix some helper functions' parameter to use PageSearchStatus Amit Shah
2016-02-05 13:56 ` [Qemu-devel] [PULL 5/9] qmp-commands.hx: Fix the missing options for migration parameters commands Amit Shah
2016-02-05 13:56 ` [Qemu-devel] [PULL 6/9] qmp-commands.hx: Document the missing options for migration capability commands Amit Shah
2016-02-05 13:56 ` [Qemu-devel] [PULL 7/9] migration: remove useless code Amit Shah
2016-02-05 13:56 ` [Qemu-devel] [PULL 8/9] static checker: e1000-82540em got aliased to e1000 Amit Shah
2016-02-11 13:04 ` Paolo Bonzini
2016-02-22 12:39 ` Amit Shah
2016-02-23 7:02 ` Jason Wang
2016-02-23 7:41 ` Amit Shah
2016-04-05 13:32 ` Dr. David Alan Gilbert
2016-04-06 1:48 ` Jason Wang
2016-04-06 13:52 ` Amit Shah
2016-04-07 7:25 ` Jason Wang
2016-02-05 13:56 ` Amit Shah [this message]
2016-02-05 15:06 ` [Qemu-devel] [PULL 0/9] migration: small fixes Peter Maydell
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=15d61692da651fc79b3fc40050b986c5a73055c0.1454680535.git.amit.shah@redhat.com \
--to=amit.shah@redhat.com \
--cc=dgilbert@redhat.com \
--cc=gkurz@linux.vnet.ibm.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/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).