Skip to content

Commit

Permalink
target-i386: Fix x86_cpuid_set_model_id()
Browse files Browse the repository at this point in the history
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.

Reviewed-by: Eduardo Habhost <ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
[AF: Use memset() instead of for loop, suggested by Igor]
Signed-off-by: Andreas Färber <afaerber@suse.de>
  • Loading branch information
afaerber committed Apr 25, 2012
1 parent cf36b31 commit d0a6acf
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions target-i386/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit d0a6acf

Please sign in to comment.