i386: Fix x86_cpu_load_model() error API violation
The Error ** argument must be NULL, &error_abort, &error_fatal, or a pointer to a variable containing NULL. Passing an argument of the latter kind twice without clearing it in between is wrong: if the first call sets an error, it no longer points to NULL for the second call. x86_cpu_load_model() is wrong that way. Harmless, because its @errp is always &error_abort. To fix, cut out the @errp middleman. Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Richard Henderson <rth@twiddle.net> Cc: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20200505101908.6207-11-armbru@redhat.com>
This commit is contained in:
parent
3b914406cf
commit
49e2fa85ff
@ -5078,7 +5078,7 @@ static void x86_cpu_apply_version_props(X86CPU *cpu, X86CPUModel *model)
|
|||||||
|
|
||||||
/* Load data from X86CPUDefinition into a X86CPU object
|
/* Load data from X86CPUDefinition into a X86CPU object
|
||||||
*/
|
*/
|
||||||
static void x86_cpu_load_model(X86CPU *cpu, X86CPUModel *model, Error **errp)
|
static void x86_cpu_load_model(X86CPU *cpu, X86CPUModel *model)
|
||||||
{
|
{
|
||||||
X86CPUDefinition *def = model->cpudef;
|
X86CPUDefinition *def = model->cpudef;
|
||||||
CPUX86State *env = &cpu->env;
|
CPUX86State *env = &cpu->env;
|
||||||
@ -5092,13 +5092,19 @@ static void x86_cpu_load_model(X86CPU *cpu, X86CPUModel *model, Error **errp)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* CPU models only set _minimum_ values for level/xlevel: */
|
/* CPU models only set _minimum_ values for level/xlevel: */
|
||||||
object_property_set_uint(OBJECT(cpu), def->level, "min-level", errp);
|
object_property_set_uint(OBJECT(cpu), def->level, "min-level",
|
||||||
object_property_set_uint(OBJECT(cpu), def->xlevel, "min-xlevel", errp);
|
&error_abort);
|
||||||
|
object_property_set_uint(OBJECT(cpu), def->xlevel, "min-xlevel",
|
||||||
|
&error_abort);
|
||||||
|
|
||||||
object_property_set_int(OBJECT(cpu), def->family, "family", errp);
|
object_property_set_int(OBJECT(cpu), def->family, "family",
|
||||||
object_property_set_int(OBJECT(cpu), def->model, "model", errp);
|
&error_abort);
|
||||||
object_property_set_int(OBJECT(cpu), def->stepping, "stepping", errp);
|
object_property_set_int(OBJECT(cpu), def->model, "model",
|
||||||
object_property_set_str(OBJECT(cpu), def->model_id, "model-id", errp);
|
&error_abort);
|
||||||
|
object_property_set_int(OBJECT(cpu), def->stepping, "stepping",
|
||||||
|
&error_abort);
|
||||||
|
object_property_set_str(OBJECT(cpu), def->model_id, "model-id",
|
||||||
|
&error_abort);
|
||||||
for (w = 0; w < FEATURE_WORDS; w++) {
|
for (w = 0; w < FEATURE_WORDS; w++) {
|
||||||
env->features[w] = def->features[w];
|
env->features[w] = def->features[w];
|
||||||
}
|
}
|
||||||
@ -5135,7 +5141,8 @@ static void x86_cpu_load_model(X86CPU *cpu, X86CPUModel *model, Error **errp)
|
|||||||
vendor = host_vendor;
|
vendor = host_vendor;
|
||||||
}
|
}
|
||||||
|
|
||||||
object_property_set_str(OBJECT(cpu), vendor, "vendor", errp);
|
object_property_set_str(OBJECT(cpu), vendor, "vendor",
|
||||||
|
&error_abort);
|
||||||
|
|
||||||
x86_cpu_apply_version_props(cpu, model);
|
x86_cpu_apply_version_props(cpu, model);
|
||||||
}
|
}
|
||||||
@ -6975,7 +6982,7 @@ static void x86_cpu_initfn(Object *obj)
|
|||||||
object_property_add_alias(obj, "sse4_2", obj, "sse4.2");
|
object_property_add_alias(obj, "sse4_2", obj, "sse4.2");
|
||||||
|
|
||||||
if (xcc->model) {
|
if (xcc->model) {
|
||||||
x86_cpu_load_model(cpu, xcc->model, &error_abort);
|
x86_cpu_load_model(cpu, xcc->model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user