commit 73bec18293b7236409e9020eaa5b922bcacabd2f
Author: Tony Luck <tony.luck@intel.com>
Date:   Mon Aug 5 10:32:34 2013 -0700

    pstore: experimental fix for problems with junk at end of zipped files
    
    In Message-ID: <51FFDC8B.7010909@linux.vnet.ibm.com> Aruna suggested
    these modifications to avoid problems with garbage at the end of
    compressed files.

diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 8f3e5f0..876cc95 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -283,7 +283,7 @@ static void pstore_dump(struct kmsg_dumper *dumper,
 		unsigned long size, big_buf_sz;
 		int hsize = 0;
 		int zipped_len = -1;
-		size_t len;
+		size_t len, total_len;
 		bool compressed;
 
 		big_buf_sz = (psinfo->bufsize * 100) / 45;
@@ -303,6 +303,7 @@ static void pstore_dump(struct kmsg_dumper *dumper,
 		}
 
 		if (zipped_len < 0) {
+			pr_err("Compression failed\n");
 			dst = psinfo->buf;
 			hsize = sprintf(dst, "%s#%d Part%d\n",
 					why, oopscount, part);
@@ -313,17 +314,18 @@ static void pstore_dump(struct kmsg_dumper *dumper,
 			if (!kmsg_dump_get_buffer(dumper, true, dst,
 								size, &len))
 				break;
+			total_len = hsize + len;
 		} else {
 			compressed = true;
-			len = zipped_len;
+			total_len = zipped_len;
 		}
 
 		ret = psinfo->write(PSTORE_TYPE_DMESG, reason, &id, part,
-				    oopscount, compressed, hsize + len, psinfo);
+				    oopscount, compressed, total_len, psinfo);
 		if (ret == 0 && reason == KMSG_DUMP_OOPS && pstore_is_mounted())
 			pstore_new_entry = 1;
 
-		total += hsize + len;
+		total += total_len;
 		part++;
 	}
 	if (pstore_cannot_block_path(reason)) {
