From patchwork Thu Feb 4 09:20:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 8214961 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 E4887BEEE5 for ; Thu, 4 Feb 2016 09:20:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5A40620306 for ; Thu, 4 Feb 2016 09:20:27 +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 A8046202C8 for ; Thu, 4 Feb 2016 09:20:26 +0000 (UTC) Received: from localhost ([::1]:40479 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRG5S-0007Oi-1q for patchwork-qemu-devel@patchwork.kernel.org; Thu, 04 Feb 2016 04:20:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46984) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRG5I-0007OJ-EQ for qemu-devel@nongnu.org; Thu, 04 Feb 2016 04:20:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aRG5F-00028e-6Z for qemu-devel@nongnu.org; Thu, 04 Feb 2016 04:20:16 -0500 Received: from e06smtp10.uk.ibm.com ([195.75.94.106]:35381) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRG5E-00028R-T7 for qemu-devel@nongnu.org; Thu, 04 Feb 2016 04:20:13 -0500 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 4 Feb 2016 09:20:10 -0000 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 4 Feb 2016 09:20:08 -0000 X-IBM-Helo: d06dlp02.portsmouth.uk.ibm.com X-IBM-MailFrom: gkurz@linux.vnet.ibm.com X-IBM-RcptTo: qemu-devel@nongnu.org Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id E5ED2219004D for ; Thu, 4 Feb 2016 09:19:54 +0000 (GMT) Received: from d06av09.portsmouth.uk.ibm.com (d06av09.portsmouth.uk.ibm.com [9.149.37.250]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u149K8Ve55574646 for ; Thu, 4 Feb 2016 09:20:08 GMT Received: from d06av09.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u149K8XQ003658 for ; Thu, 4 Feb 2016 02:20:08 -0700 Received: from smtp.lab.toulouse-stg.fr.ibm.com (srv01.lab.toulouse-stg.fr.ibm.com [9.101.4.1]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u149K8RA003655; Thu, 4 Feb 2016 02:20:08 -0700 Received: from bahia.huguette.org (sig-9-83-78-101.evts.uk.ibm.com [9.83.78.101]) by smtp.lab.toulouse-stg.fr.ibm.com (Postfix) with ESMTP id 98394220302; Thu, 4 Feb 2016 10:20:07 +0100 (CET) From: Greg Kurz To: Amit Shah , Juan Quintela Date: Thu, 04 Feb 2016 10:20:07 +0100 Message-ID: <20160204092007.31588.66396.stgit@bahia.huguette.org> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16020409-0041-0000-0000-000007282F85 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.75.94.106 Cc: qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH] 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 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. Signed-off-by: Greg Kurz Reviewed-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 954988d12130..3335cc23175c 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'", + state->len, state->name, current_name); return -EINVAL; } return 0;