From 97032b465a43842f2346ba3566b2f4ef3bd0c1ae Mon Sep 17 00:00:00 2001 From: "Aneesh Kumar K.V" Date: Fri, 17 Jul 2015 16:24:26 -0700 Subject: 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 Cc: "H. Peter Anvin" Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- lib/decompress.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib') 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)) -- cgit v1.2.3