xen/arm: kernel: Propagate the error if we fail to decompress the kernel
authorJulien Grall <jgrall@amazon.com>
Tue, 6 Apr 2021 19:15:54 +0000 (20:15 +0100)
committerJulien Grall <jgrall@amazon.com>
Mon, 17 May 2021 16:09:40 +0000 (17:09 +0100)
commit27eb6833134d0f3ddfb02d09055776e837e9a747
tree7ff0c66442bf726e500bf8812a2b337315022035
parent71a25d03b70b399d666d05a3d0046d821248c80e
xen/arm: kernel: Propagate the error if we fail to decompress the kernel

Currently, we are ignoring any error from perform_gunzip() and replacing
the compressed kernel with the "uncompressed" kernel.

If there is a gzip failure, then it means that the output buffer may
contain garbagge. So it can result to various sort of behavior that may
be difficult to root cause.

In case of failure, free the output buffer and propagate the error.
We also need to adjust the return check for kernel_compress() as
perform_gunzip() may return a positive value.

Take the opportunity to adjust the code style for the check.

Signed-off-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Michal Orzel <michal.orzel@arm.com>
xen/arch/arm/kernel.c