[Qemu-devel] [PATCH v2 01/15] target-i386: Fix x86_cpuid_set_model_id()
Don't assume zeroed cpuid_model[] fields. This doesn'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 afaer...@suse.de Reviewed-by: Eduardo Habkost ehabk...@redhat.com --- target-i386/cpu.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 3df53ca..80c1ca5 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -627,6 +627,9 @@ static void x86_cpuid_set_model_id(CPUX86State *env, const char *model_id) model_id = ; } len = strlen(model_id); +for (i = 0; i 12; i++) { +env-cpuid_model[i] = 0; +} for (i = 0; i 48; i++) { if (i = len) { c = '\0'; -- 1.7.7
Re: [Qemu-devel] [PATCH v2 01/15] target-i386: Fix x86_cpuid_set_model_id()
On 04/24/2012 11:33 AM, Andreas Färber wrote: Don't assume zeroed cpuid_model[] fields. This doesn'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ärberafaer...@suse.de Reviewed-by: Eduardo Habkostehabk...@redhat.com --- target-i386/cpu.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 3df53ca..80c1ca5 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -627,6 +627,9 @@ static void x86_cpuid_set_model_id(CPUX86State *env, const char *model_id) model_id = ; } len = strlen(model_id); +for (i = 0; i 12; i++) { +env-cpuid_model[i] = 0; +} It's not important, but why not to use memset here? for (i = 0; i 48; i++) { if (i= len) { c = '\0'; -- - Igor
Re: [Qemu-devel] [PATCH v2 01/15] target-i386: Fix x86_cpuid_set_model_id()
Am 24.04.2012 13:32, schrieb Igor Mammedov: On 04/24/2012 11:33 AM, Andreas Färber wrote: Don't assume zeroed cpuid_model[] fields. This doesn't break anything yet but QOM properties should be able to set Should've read didn't. I sure hope it doesn't. :) the value to something else without setting an intermediate zero string. Signed-off-by: Andreas Färberafaer...@suse.de Reviewed-by: Eduardo Habkostehabk...@redhat.com --- target-i386/cpu.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 3df53ca..80c1ca5 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -627,6 +627,9 @@ static void x86_cpuid_set_model_id(CPUX86State *env, const char *model_id) model_id = ; } len = strlen(model_id); +for (i = 0; i 12; i++) { +env-cpuid_model[i] = 0; +} It's not important, but why not to use memset here? I guess I was blinded by the for loop below. ;) Will change it for the PULL if there's no other reason to resend. Thanks for asking, Andreas for (i = 0; i 48; i++) { if (i= len) { c = '\0'; -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg