]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
dump: Assert cpu_get_note_size() can't fail
authorMarkus Armbruster <armbru@redhat.com>
Tue, 7 Feb 2023 07:51:06 +0000 (08:51 +0100)
committerMarkus Armbruster <armbru@redhat.com>
Thu, 23 Feb 2023 13:10:17 +0000 (14:10 +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

index e6833e4cc023c9b24a8cdec8782e9a978547f94a..1362810991c968e112f75717ca0f09be9198c2bb 100644 (file)
@@ -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