[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 15/18] s390x/cpumodel: Fix query-cpu-definitions error API vio
From: |
Markus Armbruster |
Subject: |
[PATCH v2 15/18] s390x/cpumodel: Fix query-cpu-definitions error API violations |
Date: |
Wed, 4 Dec 2019 10:36:22 +0100 |
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>
---
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 3ed301b5e5..547bab8ac3 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
- [PATCH v2 07/18] hw/core: Fix fit_load_fdt() error handling violations, (continued)
- [PATCH v2 07/18] hw/core: Fix fit_load_fdt() error handling violations, Markus Armbruster, 2019/12/04
- [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 <=
- [PATCH v2 12/18] s390x/cpumodel: Fix feature property error API violations, Markus Armbruster, 2019/12/04
- 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