Skip to contentSkip to conversation

pstore: Don't warn if data is uncompressed and type is not PSTORE_TYPE_DMESG

PATCH In review Ankit Kumar 2 participants 2 messages May 23, 2017 – May 24, 2017 Pstore filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pstore: Don't warn if data is uncompressed and type is not PSTORE_TYPE_DMESG

commit 9abdcccc3d5f ("pstore: Extract common arguments into structure") moved record decompression to function. decompress_record() gets called without checking type and compressed flag. Warning will be reported if data is uncompressed. Pstore type PSTORE_TYPE_PPC_OPAL, PSTORE_TYPE_PPC_COMMON doesn't contain compressed data and warning get printed part of dmesg.

Partial dmesg log:

[   35.848914] pstore: ignored compressed record type 6
[   35.848927] pstore: ignored compressed record type 8

Above warning should not get printed as it is known that data won't be compressed for above type and it is valid condition.

This patch returns if data is not compressed and print warning only if data is compressed and type is not PSTORE_TYPE_DMESG.

---
 fs/pstore/platform.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
fs/pstore/platform.c +4 -1
index d468eec..b304553 100644
@@ -770,8 +770,11 @@ static void decompress_record(struct pstore_record *record)
 	int unzipped_len;
 	char *decompressed;
 
+	if (!record->compressed)
+		return;
+
 	/* Only PSTORE_TYPE_DMESG support compression. */
-	if (!record->compressed || record->type != PSTORE_TYPE_DMESG) {
+	if (record->type != PSTORE_TYPE_DMESG) {
 		pr_warn("ignored compressed record type %d\n", record->type);
 		return;
 	}
Signature · 1 line
2.7.4
#1 lore raw
Quoted 7 lines · Ankit Kumar

commit 9abdcccc3d5f ("pstore: Extract common arguments into structure") moved record decompression to function. decompress_record() gets called without checking type and compressed flag. Warning will be reported if data is uncompressed. Pstore type PSTORE_TYPE_PPC_OPAL, PSTORE_TYPE_PPC_COMMON doesn't contain compressed data and warning get printed part of dmesg.

Partial dmesg log:

Quoted 8 lines
[   35.848914] pstore: ignored compressed record type 6
[   35.848927] pstore: ignored compressed record type 8

Above warning should not get printed as it is known that data won't be compressed for above type and it is valid condition.

This patch returns if data is not compressed and print warning only if data is compressed and type is not PSTORE_TYPE_DMESG.

Ah, thanks for catching that! Applied for -next.

-Kees

Quoted 28 lines
---
 fs/pstore/platform.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
fs/pstore/platform.c +4 -2
index d468eec..b304553 100644
@@ -770,8 +770,11 @@ static void decompress_record(struct pstore_record *record)
        int unzipped_len;
        char *decompressed;
 
+       if (!record->compressed)
+               return;
+
        /* Only PSTORE_TYPE_DMESG support compression. */
-       if (!record->compressed || record->type != PSTORE_TYPE_DMESG) {
+       if (record->type != PSTORE_TYPE_DMESG) {
                pr_warn("ignored compressed record type %d\n", record->type);
                return;
        }
--

2.7.4

Signature · 2 lines
Kees Cook
Pixel Security