[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 11/16] s390x/cpumodel: Fix feature property error API violations
From: |
Cornelia Huck |
Subject: |
[PULL 11/16] s390x/cpumodel: Fix feature property error API violations |
Date: |
Fri, 13 Dec 2019 17:18:46 +0100 |
From: Markus Armbruster <address@hidden>
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>
Message-Id: <address@hidden>
Signed-off-by: Cornelia Huck <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 7e92fb2e156d..6a29fd3ab113 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
- [PULL 01/16] vfio-ccw: Fix error message, (continued)
- [PULL 01/16] vfio-ccw: Fix error message, Cornelia Huck, 2019/12/13
- [PULL 02/16] hw: add compat machines for 5.0, Cornelia Huck, 2019/12/13
- [PULL 03/16] s390x: Don't do a normal reset on the initial cpu, Cornelia Huck, 2019/12/13
- [PULL 04/16] s390x: Move reset normal to shared reset handler, Cornelia Huck, 2019/12/13
- [PULL 05/16] s390x: Move initial reset, Cornelia Huck, 2019/12/13
- [PULL 06/16] s390x: Move clear reset, Cornelia Huck, 2019/12/13
- [PULL 08/16] s390x: kvm: Make kvm_sclp_service_call void, Cornelia Huck, 2019/12/13
- [PULL 07/16] s390x: Beautify diag308 handling, Cornelia Huck, 2019/12/13
- [PULL 10/16] s390x/event-facility: Fix realize() error API violations, Cornelia Huck, 2019/12/13
- [PULL 09/16] s390x: Fix cpu normal reset ri clearing, Cornelia Huck, 2019/12/13
- [PULL 11/16] s390x/cpumodel: Fix feature property error API violations,
Cornelia Huck <=
- [PULL 12/16] s390x/cpumodel: Fix realize() error API violations, Cornelia Huck, 2019/12/13
- [PULL 13/16] s390x/cpumodel: Fix query-cpu-model-FOO error API violations, Cornelia Huck, 2019/12/13
- [PULL 14/16] s390x/cpumodel: Fix query-cpu-definitions error API violations, Cornelia Huck, 2019/12/13
- [PULL 15/16] s390x/tcg: clear local interrupts on reset normal, Cornelia Huck, 2019/12/13
- [PULL 16/16] qga: fence guest-set-time if hwclock not available, Cornelia Huck, 2019/12/13
- Re: [PULL 00/16] first s390x update for 5.0, Peter Maydell, 2019/12/13