From patchwork Fri Feb 5 13:56:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Shah X-Patchwork-Id: 8234621 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5DF3CBEEE5 for ; Fri, 5 Feb 2016 14:01:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EA7E820389 for ; Fri, 5 Feb 2016 14:01:04 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 701B52012E for ; Fri, 5 Feb 2016 14:01:00 +0000 (UTC) Received: from localhost ([::1]:48474 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRgwV-00073s-Ui for patchwork-qemu-devel@patchwork.kernel.org; Fri, 05 Feb 2016 09:00:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54412) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRgt7-0001gr-8v for qemu-devel@nongnu.org; Fri, 05 Feb 2016 08:57:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aRgt6-00032e-DS for qemu-devel@nongnu.org; Fri, 05 Feb 2016 08:57:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35554) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRgt6-00032C-85 for qemu-devel@nongnu.org; Fri, 05 Feb 2016 08:57:28 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id B96A87AEB5; Fri, 5 Feb 2016 13:57:27 +0000 (UTC) Received: from localhost (dhcp193-102.pnq.redhat.com [10.65.193.102]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u15DvQlu003996; Fri, 5 Feb 2016 08:57:26 -0500 From: Amit Shah To: Peter Maydell Date: Fri, 5 Feb 2016 19:26:54 +0530 Message-Id: <15d61692da651fc79b3fc40050b986c5a73055c0.1454680535.git.amit.shah@redhat.com> In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: qemu list , Amit Shah , Greg Kurz , "Dr. David Alan Gilbert" , Juan Quintela Subject: [Qemu-devel] [PULL 9/9] migration: fix bad string passed to error_report() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Greg Kurz 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 Signed-off-by: Greg Kurz Message-Id: <20160205083201.2201.76109.stgit@bahia.huguette.org> Signed-off-by: Amit Shah --- 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;