From d0a6acf456a2497ce9f70f8366a5b405745ba279 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andreas=20F=C3=A4rber?= Date: Tue, 17 Apr 2012 18:21:52 +0200 Subject: [PATCH] target-i386: Fix x86_cpuid_set_model_id() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Igor Mammedov [AF: Use memset() instead of for loop, suggested by Igor] Signed-off-by: Andreas Färber --- target-i386/cpu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 3df53ca74b2..e1517e65c60 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -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'; -- 2.39.5