[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 03/12] dump: Assert cpu_get_note_size() can't fail
From: |
Markus Armbruster |
Subject: |
[PULL 03/12] dump: Assert cpu_get_note_size() can't fail |
Date: |
Thu, 23 Feb 2023 14:46:17 +0100 |
The only way cpu_get_note_size() can return a negative value is
integer overflow in the non-stub versions, which is a programming
error. The stub version is not actually reachable, because the
cpu_get_dump_info() stub will fail first. Use assert(). This gets
rid of another use of QERR_UNSUPPORTED.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20230207075115.1525-4-armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Juan Quintela <quintela@redhat.com>
---
dump/dump.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/dump/dump.c b/dump/dump.c
index e6833e4cc0..1362810991 100644
--- a/dump/dump.c
+++ b/dump/dump.c
@@ -1865,10 +1865,7 @@ static void dump_init(DumpState *s, int fd, bool
has_format,
s->note_size = cpu_get_note_size(s->dump_info.d_class,
s->dump_info.d_machine, nr_cpus);
- if (s->note_size < 0) {
- error_setg(errp, QERR_UNSUPPORTED);
- goto cleanup;
- }
+ assert(s->note_size >= 0);
/*
* The goal of this block is to (a) update the previously guessed
--
2.39.0
- [PULL 00/12] Error reporting patches patches for 2023-02-23, Markus Armbruster, 2023/02/23
- [PULL 02/12] dump: Improve error message when target doesn't support memory dump, Markus Armbruster, 2023/02/23
- [PULL 03/12] dump: Assert cpu_get_note_size() can't fail,
Markus Armbruster <=
- [PULL 09/12] replay: Simplify setting replay blockers, Markus Armbruster, 2023/02/23
- [PULL 10/12] hw/core: Improve the query-hotpluggable-cpus error message, Markus Armbruster, 2023/02/23
- [PULL 01/12] error: Drop superfluous #include "qapi/qmp/qerror.h", Markus Armbruster, 2023/02/23
- [PULL 11/12] migration/colo: Improve an x-colo-lost-heartbeat error message, Markus Armbruster, 2023/02/23
- [PULL 05/12] hw/smbios: Dumb down smbios_entry_add() stub, Markus Armbruster, 2023/02/23
- [PULL 12/12] rocker: Tweak stubbed out monitor commands' error messages, Markus Armbruster, 2023/02/23
- [PULL 08/12] qga: Drop dangling reference to QERR_QGA_LOGGING_DISABLED, Markus Armbruster, 2023/02/23
- [PULL 04/12] hw/core: Improve error message when machine doesn't provide NMIs, Markus Armbruster, 2023/02/23
- [PULL 07/12] hw/acpi: Move QMP command to hw/core/, Markus Armbruster, 2023/02/23
- [PULL 06/12] hw/acpi: Dumb down acpi_table_add() stub, Markus Armbruster, 2023/02/23