diff mbox

[3/6] target-i386: use define for cpuid vendor string size

Message ID 1354649683-9078-4-git-send-email-ehabkost@redhat.com
State New
Headers show

Commit Message

Eduardo Habkost Dec. 4, 2012, 7:34 p.m. UTC
From: Igor Mammedov <imammedo@redhat.com>

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 target-i386/cpu.c | 6 +++---
 target-i386/cpu.h | 2 ++
 2 files changed, 5 insertions(+), 3 deletions(-)

Comments

Andreas Färber Dec. 5, 2012, 11:29 a.m. UTC | #1
Am 04.12.2012 20:38, schrieb Eduardo Habkost:
> On Tue, Dec 04, 2012 at 05:34:40PM -0200, Eduardo Habkost wrote:
>> From: Igor Mammedov <imammedo@redhat.com>
>>
>> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> 
> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>

As a reminder, when you submit patches, I need your Sob added.
In these particular cases, I can usually search the list for an earlier
submission by Igor and take that, but it would be more time-efficient if
I could just apply the latest submitted version with Sobs.

If you cherry-pick patches from your colleague's branch, you can use
git-cherry-pick's -s option to facilitate this.

Regards,
Andreas
Eduardo Habkost Dec. 5, 2012, 11:51 a.m. UTC | #2
On Wed, Dec 05, 2012 at 12:29:06PM +0100, Andreas Färber wrote:
> Am 04.12.2012 20:38, schrieb Eduardo Habkost:
> > On Tue, Dec 04, 2012 at 05:34:40PM -0200, Eduardo Habkost wrote:
> >> From: Igor Mammedov <imammedo@redhat.com>
> >>
> >> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > 
> > Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
> 
> As a reminder, when you submit patches, I need your Sob added.
> In these particular cases, I can usually search the list for an earlier
> submission by Igor and take that, but it would be more time-efficient if
> I could just apply the latest submitted version with Sobs.
> 
> If you cherry-pick patches from your colleague's branch, you can use
> git-cherry-pick's -s option to facilitate this.

Sorry, I'll do that next time.

BTW, I cherry-picked the patches from igor's tree directly (after
discussing with him), so I don't know if all of them have been submitted
to the list before.

For reference, they are:
https://github.com/imammedo/qemu/commit/b515a509d6e175681bbd85d2833400b1d5368877
https://github.com/imammedo/qemu/commit/4c9d836d4e6589493c82c21dd9b48ddc244c0a3d
https://github.com/imammedo/qemu/commit/cf301a2013c99e22cab55f9e840c3885b6130c38
https://github.com/imammedo/qemu/commit/dc70027e0bd190832527b68579704384fd8b950b

> 
> Regards,
> Andreas
> 
> -- 
> SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
> GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Igor Mammedov Dec. 5, 2012, 12:03 p.m. UTC | #3
On Wed, 5 Dec 2012 09:51:25 -0200
Eduardo Habkost <ehabkost@redhat.com> wrote:

> On Wed, Dec 05, 2012 at 12:29:06PM +0100, Andreas Färber wrote:
> > Am 04.12.2012 20:38, schrieb Eduardo Habkost:
> > > On Tue, Dec 04, 2012 at 05:34:40PM -0200, Eduardo Habkost wrote:
> > >> From: Igor Mammedov <imammedo@redhat.com>
> > >>
> > >> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > > 
> > > Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
> > 
> > As a reminder, when you submit patches, I need your Sob added.
> > In these particular cases, I can usually search the list for an earlier
> > submission by Igor and take that, but it would be more time-efficient if
> > I could just apply the latest submitted version with Sobs.
> > 
> > If you cherry-pick patches from your colleague's branch, you can use
> > git-cherry-pick's -s option to facilitate this.
> 
> Sorry, I'll do that next time.
> 
> BTW, I cherry-picked the patches from igor's tree directly (after
> discussing with him), so I don't know if all of them have been submitted
> to the list before.
They were submitted in v5 cpu properties series.
Message-Id: <1350918203-25198-7-git-send-email-imammedo@redhat.com>
Message-Id: <1350918203-25198-8-git-send-email-imammedo@redhat.com>
Message-Id: <1350918203-25198-25-git-send-email-imammedo@redhat.com>
Message-Id: <1350918203-25198-15-git-send-email-imammedo@redhat.com>

> 
> For reference, they are:
> https://github.com/imammedo/qemu/commit/b515a509d6e175681bbd85d2833400b1d5368877
> https://github.com/imammedo/qemu/commit/4c9d836d4e6589493c82c21dd9b48ddc244c0a3d
> https://github.com/imammedo/qemu/commit/cf301a2013c99e22cab55f9e840c3885b6130c38
> https://github.com/imammedo/qemu/commit/dc70027e0bd190832527b68579704384fd8b950b
> 
> > 
> > Regards,
> > Andreas
> > 
> > -- 
> > SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
> > GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
>
diff mbox

Patch

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" */