[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 14/16] s390x/cpumodel: Fix query-cpu-definitions error API viol
From: |
Cornelia Huck |
Subject: |
[PULL v2 14/16] s390x/cpumodel: Fix query-cpu-definitions error API violations |
Date: |
Sat, 14 Dec 2019 10:45:24 +0100 |
From: Markus Armbruster <address@hidden>
qmp_query_cpu_definitions() passes @errp to get_max_cpu_model(), then
frees any error it gets back. This effectively ignores errors.
Dereferencing @errp is wrong; see the big comment in error.h. Passing
@errp is also wrong, because it works only as long as @errp is neither
@error_fatal nor @error_abort. Introduced in commit 38cba1f4d8
"s390x: return unavailable features via query-cpu-definitions".
No caller actually passes such @errp values.
Fix anyway: simply pass NULL to get_max_cpu_model().
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 | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
index 3ed301b5e509..547bab8ac392 100644
--- a/target/s390x/cpu_models.c
+++ b/target/s390x/cpu_models.c
@@ -462,11 +462,7 @@ CpuDefinitionInfoList *qmp_query_cpu_definitions(Error
**errp)
.list = NULL,
};
- list_data.model = get_max_cpu_model(errp);
- if (*errp) {
- error_free(*errp);
- *errp = NULL;
- }
+ list_data.model = get_max_cpu_model(NULL);
object_class_foreach(create_cpu_model_list, TYPE_S390_CPU, false,
&list_data);
--
2.21.0
- [PULL v2 05/16] s390x: Move initial reset, (continued)
- [PULL v2 05/16] s390x: Move initial reset, Cornelia Huck, 2019/12/14
- [PULL v2 04/16] s390x: Move reset normal to shared reset handler, Cornelia Huck, 2019/12/14
- [PULL v2 06/16] s390x: Move clear reset, Cornelia Huck, 2019/12/14
- [PULL v2 07/16] s390x: Beautify diag308 handling, Cornelia Huck, 2019/12/14
- [PULL v2 08/16] s390x: kvm: Make kvm_sclp_service_call void, Cornelia Huck, 2019/12/14
- [PULL v2 10/16] s390x/event-facility: Fix realize() error API violations, Cornelia Huck, 2019/12/14
- [PULL v2 11/16] s390x/cpumodel: Fix feature property error API violations, Cornelia Huck, 2019/12/14
- [PULL v2 09/16] s390x: Fix cpu normal reset ri clearing, Cornelia Huck, 2019/12/14
- [PULL v2 12/16] s390x/cpumodel: Fix realize() error API violations, Cornelia Huck, 2019/12/14
- [PULL v2 13/16] s390x/cpumodel: Fix query-cpu-model-FOO error API violations, Cornelia Huck, 2019/12/14
- [PULL v2 14/16] s390x/cpumodel: Fix query-cpu-definitions error API violations,
Cornelia Huck <=
- [PULL v2 15/16] s390x/tcg: clear local interrupts on reset normal, Cornelia Huck, 2019/12/14
- [PULL v2 16/16] qga: fence guest-set-time if hwclock not available, Cornelia Huck, 2019/12/14
- Re: [PULL v2 00/16] first s390x update for 5.0, Peter Maydell, 2019/12/16