Skip to contentSkip to conversation

lib/decompress: Set the compressor name to NULL on error

PATCH New Aneesh Kumar K.V 1 participant 1 message Jul 15, 2015 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 lib/decompress.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
lib/decompress.c +4 -1
index 528ff932d8e4..62696dff5730 100644
@@ -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]);
 
Signature · 1 line
2.1.4