Commit 4a16d1cb authored by Ankit Kumar's avatar Ankit Kumar Committed by Kees Cook

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

commit 9abdcccc ("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.
Reported-by: default avatarAnton Blanchard <anton@au1.ibm.com>
Signed-off-by: default avatarAnkit Kumar <ankit@linux.vnet.ibm.com>
Reviewed-by: default avatarMahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Fixes: 9abdcccc ("pstore: Extract common arguments into structure")
Cc: stable@vger.kernel.org
parent 5ed02dbb
...@@ -770,8 +770,11 @@ static void decompress_record(struct pstore_record *record) ...@@ -770,8 +770,11 @@ static void decompress_record(struct pstore_record *record)
int unzipped_len; int unzipped_len;
char *decompressed; char *decompressed;
if (!record->compressed)
return;
/* Only PSTORE_TYPE_DMESG support compression. */ /* 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); pr_warn("ignored compressed record type %d\n", record->type);
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment