qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 03/12] dump: Assert cpu_get_note_size() can't fail


From: Markus Armbruster
Subject: [PATCH 03/12] dump: Assert cpu_get_note_size() can't fail
Date: Tue, 7 Feb 2023 08:51:06 +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>
---
 dump/dump.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/dump/dump.c b/dump/dump.c
index 80620da40d..6be8a65fe3 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]