Received: from eggs.gnu.org ([208.118.235.92]:34760) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TfyIY-0004RM-DX for qemu-devel@nongnu.org; Tue, 04 Dec 2012 14:36:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TfyIX-0007CW-6x for qemu-devel@nongnu.org; Tue, 04 Dec 2012 14:36:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:21462) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TfyIW-0007CP-UK for qemu-devel@nongnu.org; Tue, 04 Dec 2012 14:36:53 -0500 Date: Tue, 4 Dec 2012 17:38:26 -0200 From: Eduardo Habkost Message-ID: <20121204193826.GE4986@otherpad.lan.raisama.net> References: <1354649683-9078-1-git-send-email-ehabkost@redhat.com> <1354649683-9078-4-git-send-email-ehabkost@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1354649683-9078-4-git-send-email-ehabkost@redhat.com> Subject: Re: [Qemu-devel] [PATCH 3/6] target-i386: use define for cpuid vendor string size List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Igor Mammedov , Don Slutz , Andreas =?iso-8859-1?Q?F=E4rber?= On Tue, Dec 04, 2012 at 05:34:40PM -0200, Eduardo Habkost wrote: > From: Igor Mammedov > > Signed-off-by: Igor Mammedov Reviewed-by: Eduardo Habkost > --- > 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 70ba323..05ac79a 100644 > --- a/target-i386/cpu.c > +++ b/target-i386/cpu.c > @@ -1106,13 +1106,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; > } > > @@ -1123,7 +1123,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 90ef1ff..386c4f6 100644 > --- a/target-i386/cpu.h > +++ b/target-i386/cpu.h > @@ -510,6 +510,8 @@ > #define CPUID_7_0_EBX_ADX (1 << 19) > #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" */ > -- > 1.7.11.7 > > -- Eduardo