commit 35b489152ae8f673fa79e7eeffc0bc8503c608b6 Author: Aruna Balakrishnaiah Date: Tue Aug 6 00:08:35 2013 +0530 pstore: fix for the junk characters at the end Signed-off-by: Aruna Balakrishnaiah diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index 8f3e5f0..3446c99 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; @@ -293,9 +293,8 @@ static void pstore_dump(struct kmsg_dumper *dumper, hsize = sprintf(dst, "%s#%d Part%d\n", why, oopscount, part); size = big_buf_sz - hsize; - dst += hsize; - if (!kmsg_dump_get_buffer(dumper, true, dst, + if (!kmsg_dump_get_buffer(dumper, true, dst + hsize, size, &len)) break; @@ -313,17 +312,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)) {