libxenguest: simplify kernel decompression
authorJan Beulich <jbeulich@suse.com>
Mon, 12 Apr 2021 10:26:18 +0000 (12:26 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 12 Apr 2021 10:26:18 +0000 (12:26 +0200)
commitd3d9889467ca4a0ddc5dc9222d353c37a3e8dc6a
treece83a582c46658c7d0808e971e95e1e4c12e9243
parentc5dad825d98a818cbc123a22777bd7110d00bffb
libxenguest: simplify kernel decompression

In all cases the kernel build makes available the uncompressed size in
the final 4 bytes of the bzImage payload. Utilize this to avoid
repeated realloc()ing of the output buffer.

As a side effect this also addresses the previous mistaken return of 0
(success) from xc_try_{bzip2,lzma,xz}_decode() in case
xc_dom_register_external() would have failed.

As another side effect this also addresses the first error path of
_xc_try_lzma_decode() previously bypassing lzma_end().

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Wei Liu <wl@xen.org>
tools/libs/guest/xg_dom_bzimageloader.c