summaryrefslogtreecommitdiff
path: root/lib/decompress.c
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2015-07-17 16:24:26 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2015-07-17 16:39:54 -0700
commit5a09e6ce90e1bf26f0915e7e31329402766ffead (patch)
treebed9fcfa10bbe4fd2ea22f768134706d3fcdf7ff /lib/decompress.c
parentd56e84b4064d65285161d6bfa04382e1cdd4e49c (diff)
downloadlwn-5a09e6ce90e1bf26f0915e7e31329402766ffead.tar.gz
lwn-5a09e6ce90e1bf26f0915e7e31329402766ffead.zip
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/decompress.c')
-rw-r--r--lib/decompress.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/decompress.c b/lib/decompress.c
index 528ff932d8e4..62696dff5730 100644
--- a/lib/decompress.c
+++ b/lib/decompress.c
@@ -59,8 +59,11 @@ decompress_fn __init decompress_method(const unsigned char *inbuf, long len,
{
const struct compress_format *cf;
- if (len < 2)
+ if (len < 2) {
+ if (name)
+ *name = NULL;
return NULL; /* Need at least this much... */
+ }
pr_debug("Compressed data magic: %#.2x %#.2x\n", inbuf[0], inbuf[1]);