From patchwork Tue Oct 2 15:37:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Mammedov X-Patchwork-Id: 188575 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 933A92C008E for ; Wed, 3 Oct 2012 02:36:31 +1000 (EST) Received: from localhost ([::1]:39931 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJ4YW-0000XB-97 for incoming@patchwork.ozlabs.org; Tue, 02 Oct 2012 11:38:44 -0400 Received: from eggs.gnu.org ([208.118.235.92]:33214) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJ4YH-0000Mp-4l for qemu-devel@nongnu.org; Tue, 02 Oct 2012 11:38:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TJ4YC-0000Pb-W5 for qemu-devel@nongnu.org; Tue, 02 Oct 2012 11:38:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43728) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJ4YC-0000PH-N9 for qemu-devel@nongnu.org; Tue, 02 Oct 2012 11:38:24 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q92FcINZ014673 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 2 Oct 2012 11:38:18 -0400 Received: from dell-pet610-01.lab.eng.brq.redhat.com (dell-pet610-01.lab.eng.brq.redhat.com [10.34.42.20]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q92FbKI3021344; Tue, 2 Oct 2012 11:38:15 -0400 From: Igor Mammedov To: qemu-devel@nongnu.org Date: Tue, 2 Oct 2012 17:37:08 +0200 Message-Id: <1349192235-31895-17-git-send-email-imammedo@redhat.com> In-Reply-To: <1349192235-31895-1-git-send-email-imammedo@redhat.com> References: <1349192235-31895-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: aliguori@us.ibm.com, hpa@linux.intel.com, ehabkost@redhat.com, jan.kiszka@siemens.com, Don@cloudswitch.com, mtosatti@redhat.com, mdroth@linux.vnet.ibm.com, blauwirbel@gmail.com, avi@redhat.com, pbonzini@redhat.com, akong@redhat.com, lersek@redhat.com, afaerber@suse.de, stefanha@linux.vnet.ibm.com Subject: [Qemu-devel] [PATCH 16/23] target-i386: use define for cpuid vendor string size 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 Signed-off-by: Igor Mammedov --- target-i386/cpu.c | 6 +++--- target-i386/cpu.h | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 04497f1..038b37e 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1110,13 +1110,13 @@ static char *x86_cpuid_get_vendor(Object *obj, Error **errp) char *value; int i; - value = (char *)g_malloc(12 + 1); + value = (char *)g_malloc(CPUID_VENDOR_SZ + 1); for (i = 0; i < 4; i++) { value[i ] = env->cpuid_vendor1 >> (8 * i); value[i + 4] = env->cpuid_vendor2 >> (8 * i); value[i + 8] = env->cpuid_vendor3 >> (8 * i); } - value[12] = '\0'; + value[CPUID_VENDOR_SZ] = '\0'; return value; } @@ -1127,7 +1127,7 @@ static void x86_cpuid_set_vendor(Object *obj, const char *value, CPUX86State *env = &cpu->env; int i; - if (strlen(value) != 12) { + if (strlen(value) != CPUID_VENDOR_SZ) { error_set(errp, QERR_PROPERTY_VALUE_BAD, "", "vendor", value); return; diff --git a/target-i386/cpu.h b/target-i386/cpu.h index f99a735..c8a5270 100644 --- a/target-i386/cpu.h +++ b/target-i386/cpu.h @@ -488,6 +488,8 @@ #define CPUID_7_0_EBX_SMEP (1 << 7) #define CPUID_7_0_EBX_SMAP (1 << 20) +#define CPUID_VENDOR_SZ 12 + #define CPUID_VENDOR_INTEL_1 0x756e6547 /* "Genu" */ #define CPUID_VENDOR_INTEL_2 0x49656e69 /* "ineI" */ #define CPUID_VENDOR_INTEL_3 0x6c65746e /* "ntel" */