From patchwork Tue Apr 24 14:22:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 154684 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8D69FB6FC4 for ; Wed, 25 Apr 2012 00:22:59 +1000 (EST) Received: from localhost ([::1]:40715 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SMgdt-0005WH-Di for incoming@patchwork.ozlabs.org; Tue, 24 Apr 2012 10:22:57 -0400 Received: from eggs.gnu.org ([208.118.235.92]:55270) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SMgdi-0005Va-3M for qemu-devel@nongnu.org; Tue, 24 Apr 2012 10:22:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SMgdb-0003CH-Sf for qemu-devel@nongnu.org; Tue, 24 Apr 2012 10:22:45 -0400 Received: from cantor2.suse.de ([195.135.220.15]:38625 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SMgdb-0003C8-MX for qemu-devel@nongnu.org; Tue, 24 Apr 2012 10:22:39 -0400 Received: from relay2.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 5F963A399F; Tue, 24 Apr 2012 16:22:38 +0200 (CEST) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Tue, 24 Apr 2012 16:22:31 +0200 Message-Id: <1335277351-30379-1-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.7.7 In-Reply-To: <4F9690E5.7090908@suse.de> References: <4F9690E5.7090908@suse.de> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-Received-From: 195.135.220.15 Cc: Igor Mammedov , Eduardo Habkost , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Michael Roth Subject: [Qemu-devel] [PATCH v3 01/15] target-i386: Fix x86_cpuid_set_model_id() 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Don't assume zeroed cpuid_model[] fields. This didn't break anything yet but QOM properties should be able to set the value to something else without setting an intermediate zero string. Signed-off-by: Andreas Färber --- Since I managed to screw this change up on first try (using size 12), let's better be safe than sorry and properly post the v3 for review. :-) v2 -> v3: * Use memset() instead of for loop (suggested by Igor Mammedov). target-i386/cpu.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 3df53ca..e1517e6 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -627,6 +627,7 @@ static void x86_cpuid_set_model_id(CPUX86State *env, const char *model_id) model_id = ""; } len = strlen(model_id); + memset(env->cpuid_model, 0, 48); for (i = 0; i < 48; i++) { if (i >= len) { c = '\0';