aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2015-07-17 16:24:26 -0700
committerMister Oyster <oysterized@gmail.com>2017-04-11 11:00:09 +0200
commit97032b465a43842f2346ba3566b2f4ef3bd0c1ae (patch)
tree3cf32e6c89419e8f7011a41a72dca957736e604a /lib
parent274d8965e6f38f65b068fdd8b59b51317f6d8249 (diff)
lib/decompress: set the compressor name to NULL on error
Without this we end up using the previous name of the compressor in the loop in unpack_rootfs. For example we get errors like "compression method gzip not configured" even when we have CONFIG_DECOMPRESS_GZIP enabled. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/decompress.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/decompress.c b/lib/decompress.c
index 29c0708cf..f7739bf4c 100644
--- a/lib/decompress.c
+++ b/lib/decompress.c
@@ -58,8 +58,11 @@ decompress_fn __init decompress_method(const unsigned char *inbuf, int len,
{
const struct compress_format *cf;
- if (len < 2)
+ if (len < 2) {
+ if (name)
+ *name = NULL;
return NULL; /* Need at least this much... */
+ }
for (cf = compressed_formats; cf->name; cf++) {
if (!memcmp(inbuf, cf->magic, 2))