Skip to content

Commit

Permalink
lib/decompress: set the compressor name to NULL on error
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
kvaneesh authored and torvalds committed Jul 17, 2015
1 parent d56e84b commit 5a09e6c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/decompress.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);

Expand Down

0 comments on commit 5a09e6c

Please sign in to comment.