[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 15/21] s390x/cpu_models: Fix latent feature property error handli
From: |
Markus Armbruster |
Subject: |
[PATCH 15/21] s390x/cpu_models: Fix latent feature property error handling bugs |
Date: |
Sat, 30 Nov 2019 20:42:34 +0100 |
s390x-cpu property setters set_feature() and set_feature_group() crash
when the visitor fails and its @errp argument is null. Messed up in
commit 0754f60429 "s390x/cpumodel: expose features and feature groups
as properties".
The bug can't bite as no caller actually passes null. Fix it anyway.
Cc: David Hildenbrand <address@hidden>
Cc: Cornelia Huck <address@hidden>
Signed-off-by: Markus Armbruster <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
- [PATCH 05/21] crypto: Fix typo in QCryptoTLSSession's <example> comment, (continued)
- [PATCH 05/21] crypto: Fix typo in QCryptoTLSSession's <example> comment, Markus Armbruster, 2019/11/30
- [PATCH 01/21] net/virtio: Drop useless n->primary_dev not null checks, Markus Armbruster, 2019/11/30
- [PATCH 19/21] error: Clean up unusual names of Error * variables, Markus Armbruster, 2019/11/30
- [PATCH 08/21] exec: Fix latent file_ram_alloc() error handling bug, Markus Armbruster, 2019/11/30
- [PATCH 06/21] io: Fix Error usage in a comment <example>, Markus Armbruster, 2019/11/30
- [PATCH 16/21] s390/cpu_modules: Fix latent realize() error handling bugs, Markus Armbruster, 2019/11/30
- [PATCH 14/21] s390x/event-facility: Fix latent realize() error handling bug, Markus Armbruster, 2019/11/30
- [PATCH 10/21] hw/core: Fix latent fit_load_fdt() error handling bug, Markus Armbruster, 2019/11/30
- [PATCH 07/21] tests: Clean up initialization of Error *err variables, Markus Armbruster, 2019/11/30
- [PATCH 15/21] s390x/cpu_models: Fix latent feature property error handling bugs,
Markus Armbruster <=
- [PATCH 13/21] memory-device: Fix latent memory pre-plug error handling bugs, Markus Armbruster, 2019/11/30
- [PATCH 12/21] qga: Fix latent guest-get-fsinfo error handling bug, Markus Armbruster, 2019/11/30
- [PATCH 18/21] s390x: Fix latent query-cpu-definitions error handling bug, Markus Armbruster, 2019/11/30
- [PATCH 11/21] hw/ipmi: Fix latent realize() error handling bugs, Markus Armbruster, 2019/11/30
- [PATCH 09/21] hw/acpi: Fix latent legacy CPU plug error handling bug, Markus Armbruster, 2019/11/30
- [PATCH 21/21] tests-blockjob: Use error_free_or_abort(), Markus Armbruster, 2019/11/30
- [PATCH 20/21] hw/intc/s390: Simplify error handling in kvm_s390_flic_realize(), Markus Armbruster, 2019/11/30
- [PATCH 17/21] s390x: Fix latent query-cpu-model-FOO error handling bugs, Markus Armbruster, 2019/11/30