[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 12/18] s390x/cpumodel: Fix feature property error API violatio
From: |
Markus Armbruster |
Subject: |
[PATCH v2 12/18] s390x/cpumodel: Fix feature property error API violations |
Date: |
Wed, 4 Dec 2019 10:36:19 +0100 |
s390x-cpu property setters set_feature() and set_feature_group()
dereference @errp when the visitor fails. That's wrong; see the big
comment in error.h. Introduced in commit 0754f60429 "s390x/cpumodel:
expose features and feature groups as properties".
No caller actually passes null.
Fix anyway: splice in a local Error *err, and error_propagate().
Cc: David Hildenbrand <address@hidden>
Cc: Cornelia Huck <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: David Hildenbrand <address@hidden>
---
target/s390x/cpu_models.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
index 7e92fb2e15..6a29fd3ab1 100644
--- a/target/s390x/cpu_models.c
+++ b/target/s390x/cpu_models.c
@@ -987,6 +987,7 @@ static void get_feature(Object *obj, Visitor *v, const char
*name,
static void set_feature(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
+ Error *err = NULL;
S390Feat feat = (S390Feat) opaque;
DeviceState *dev = DEVICE(obj);
S390CPU *cpu = S390_CPU(obj);
@@ -1002,8 +1003,9 @@ static void set_feature(Object *obj, Visitor *v, const
char *name,
return;
}
- visit_type_bool(v, name, &value, errp);
- if (*errp) {
+ visit_type_bool(v, name, &value, &err);
+ if (err) {
+ error_propagate(errp, err);
return;
}
if (value) {
@@ -1043,6 +1045,7 @@ static void get_feature_group(Object *obj, Visitor *v,
const char *name,
static void set_feature_group(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
+ Error *err = NULL;
S390FeatGroup group = (S390FeatGroup) opaque;
const S390FeatGroupDef *def = s390_feat_group_def(group);
DeviceState *dev = DEVICE(obj);
@@ -1059,8 +1062,9 @@ static void set_feature_group(Object *obj, Visitor *v,
const char *name,
return;
}
- visit_type_bool(v, name, &value, errp);
- if (*errp) {
+ visit_type_bool(v, name, &value, &err);
+ if (err) {
+ error_propagate(errp, err);
return;
}
if (value) {
--
2.21.0
- Re: [PATCH v2 07/18] hw/core: Fix fit_load_fdt() error handling violations, (continued)
- [PATCH v2 03/18] io: Fix Error usage in a comment <example>, Markus Armbruster, 2019/12/04
- [PATCH v2 18/18] tests-blockjob: Use error_free_or_abort(), Markus Armbruster, 2019/12/04
- [PATCH v2 14/18] s390x/cpumodel: Fix query-cpu-model-FOO error API violations, Markus Armbruster, 2019/12/04
- [PATCH v2 06/18] hw/acpi: Fix legacy CPU plug error API violations, Markus Armbruster, 2019/12/04
- [PATCH v2 10/18] memory-device: Fix memory pre-plug error API violations, Markus Armbruster, 2019/12/04
- [PATCH v2 16/18] error: Clean up unusual names of Error * variables, Markus Armbruster, 2019/12/04
- [PATCH v2 15/18] s390x/cpumodel: Fix query-cpu-definitions error API violations, Markus Armbruster, 2019/12/04
- [PATCH v2 12/18] s390x/cpumodel: Fix feature property error API violations,
Markus Armbruster <=
- Re: [PATCH v2 00/18] Error handling fixes, David Hildenbrand, 2019/12/04
- Re: [PATCH v2 00/18] Error handling fixes, Markus Armbruster, 2019/12/04
- Re: [PATCH v2 00/18] Error handling fixes, Cornelia Huck, 2019/12/05