* [PATCH 3/3] initramfs: add missing decompressor error check
@ 2009-12-14 21:45 Phillip Lougher
2009-12-15 22:58 ` [tip:x86/urgent] " tip-bot for Phillip Lougher
0 siblings, 1 reply; 2+ messages in thread
From: Phillip Lougher @ 2009-12-14 21:45 UTC (permalink / raw)
To: linux-kernel, linux-embedded, akpm; +Cc: phillip, mingo, albin.tonnerre
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>
---
init/initramfs.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/init/initramfs.c b/init/initramfs.c
index 4c00edc..b37d34b 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 */
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];
@@ -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",
--
1.6.3.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* [tip:x86/urgent] initramfs: add missing decompressor error check
2009-12-14 21:45 [PATCH 3/3] initramfs: add missing decompressor error check Phillip Lougher
@ 2009-12-15 22:58 ` tip-bot for Phillip Lougher
0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Phillip Lougher @ 2009-12-15 22:58 UTC (permalink / raw)
To: linux-tip-commits; +Cc: linux-kernel, phillip, hpa, mingo, tglx
Commit-ID: 54291362d2a5738e1b0495df2abcb9e6b0563a3f
Gitweb: http://git.kernel.org/tip/54291362d2a5738e1b0495df2abcb9e6b0563a3f
Author: Phillip Lougher <phillip@lougher.demon.co.uk>
AuthorDate: Mon, 14 Dec 2009 21:45:19 +0000
Committer: H. Peter Anvin <hpa@zytor.com>
CommitDate: Tue, 15 Dec 2009 14:04:24 -0800
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>
---
init/initramfs.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/init/initramfs.c b/init/initramfs.c
index 4c00edc..b37d34b 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 */
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];
@@ -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",
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-12-15 23:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-14 21:45 [PATCH 3/3] initramfs: add missing decompressor error check Phillip Lougher
2009-12-15 22:58 ` [tip:x86/urgent] " tip-bot for Phillip Lougher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®