aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhillip Lougher2009-12-14 15:45:19 -0600
committerH. Peter Anvin2009-12-15 16:04:24 -0600
commit54291362d2a5738e1b0495df2abcb9e6b0563a3f (patch)
tree4b013a21d326ca474a4d785bb7586f88e2832ee9 /init/initramfs.c
parentd4529862cae4de19fda8d4bbcbddc60f3e48a4cf (diff)
downloadkernel-54291362d2a5738e1b0495df2abcb9e6b0563a3f.tar.gz
kernel-54291362d2a5738e1b0495df2abcb9e6b0563a3f.tar.xz
kernel-54291362d2a5738e1b0495df2abcb9e6b0563a3f.zip
initramfs: add missing decompressor error check
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>
Diffstat (limited to 'init/initramfs.c')
-rw-r--r--init/initramfs.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/init/initramfs.c b/init/initramfs.c
index 4c00edc59689..b37d34beb90b 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -413,7 +413,7 @@ static unsigned my_inptr; /* index of next byte to be processed in inbuf */
413 413
414static char * __init unpack_to_rootfs(char *buf, unsigned len) 414static char * __init unpack_to_rootfs(char *buf, unsigned len)
415{ 415{
416 int written; 416 int written, res;
417 decompress_fn decompress; 417 decompress_fn decompress;
418 const char *compress_name; 418 const char *compress_name;
419 static __initdata char msg_buf[64]; 419 static __initdata char msg_buf[64];
@@ -445,10 +445,12 @@ static char * __init unpack_to_rootfs(char *buf, unsigned len)
445 } 445 }
446 this_header = 0; 446 this_header = 0;
447 decompress = decompress_method(buf, len, &compress_name); 447 decompress = decompress_method(buf, len, &compress_name);
448 if (decompress) 448 if (decompress) {
449 decompress(buf, len, NULL, flush_buffer, NULL, 449 res = decompress(buf, len, NULL, flush_buffer, NULL,
450 &my_inptr, error); 450 &my_inptr, error);
451 else if (compress_name) { 451 if (res)
452 error("decompressor failed");
453 } else if (compress_name) {
452 if (!message) { 454 if (!message) {
453 snprintf(msg_buf, sizeof msg_buf, 455 snprintf(msg_buf, sizeof msg_buf,
454 "compression method %s not configured", 456 "compression method %s not configured",