Skip to content

Commit

Permalink
initramfs: add missing decompressor error check
Browse files Browse the repository at this point in the history
The decompressors return error by calling a supplied error function, and/or
by returning an error return value.  The initramfs code, however, fails to
check the exit code returned by the decompressor, and only checks the error
status set by calling the error function.

This patch adds a return code check and calls the error function.

Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
LKML-Reference: <4b26b1ef.0+ZWxT6886olqcSc%phillip@lougher.demon.co.uk>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
  • Loading branch information
Phillip Lougher authored and H. Peter Anvin committed Dec 15, 2009
1 parent d452986 commit 5429136
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions init/initramfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ static unsigned my_inptr; /* index of next byte to be processed in inbuf */

static char * __init unpack_to_rootfs(char *buf, unsigned len)
{
int written;
int written, res;
decompress_fn decompress;
const char *compress_name;
static __initdata char msg_buf[64];
Expand Down Expand Up @@ -445,10 +445,12 @@ static char * __init unpack_to_rootfs(char *buf, unsigned len)
}
this_header = 0;
decompress = decompress_method(buf, len, &compress_name);
if (decompress)
decompress(buf, len, NULL, flush_buffer, NULL,
if (decompress) {
res = decompress(buf, len, NULL, flush_buffer, NULL,
&my_inptr, error);
else if (compress_name) {
if (res)
error("decompressor failed");
} else if (compress_name) {
if (!message) {
snprintf(msg_buf, sizeof msg_buf,
"compression method %s not configured",
Expand Down

0 comments on commit 5429136

Please sign in to comment.