diff options
author | Arve Hjønnevåg <arve@android.com> | 2012-12-06 00:19:51 -0500 |
---|---|---|
committer | Anton Vorontsov <anton@enomsg.org> | 2013-04-04 00:50:10 -0400 |
commit | bd08ec33b5c23833581e5a36b2a69ccae6b39a28 (patch) | |
tree | 36da2618929a667d13b1a9408c2e9427cf32456c | |
parent | c31ad081e8734aab3fb45d2f32e9969994dd076e (diff) |
pstore/ram: Restore ecc information block
This was lost when proc/last_kmsg moved to pstore/console-ramoops.
Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
-rw-r--r-- | fs/pstore/ram.c | 12 | ||||
-rw-r--r-- | fs/pstore/ram_core.c | 3 |
2 files changed, 13 insertions, 2 deletions
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index a5ee252c264e..32cbd7c8a90c 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c | |||
@@ -136,6 +136,7 @@ static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type, | |||
136 | char **buf, struct pstore_info *psi) | 136 | char **buf, struct pstore_info *psi) |
137 | { | 137 | { |
138 | ssize_t size; | 138 | ssize_t size; |
139 | ssize_t ecc_notice_size; | ||
139 | struct ramoops_context *cxt = psi->data; | 140 | struct ramoops_context *cxt = psi->data; |
140 | struct persistent_ram_zone *prz; | 141 | struct persistent_ram_zone *prz; |
141 | 142 | ||
@@ -156,11 +157,18 @@ static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type, | |||
156 | time->tv_nsec = 0; | 157 | time->tv_nsec = 0; |
157 | 158 | ||
158 | size = persistent_ram_old_size(prz); | 159 | size = persistent_ram_old_size(prz); |
159 | *buf = kmemdup(persistent_ram_old(prz), size, GFP_KERNEL); | 160 | |
161 | /* ECC correction notice */ | ||
162 | ecc_notice_size = persistent_ram_ecc_string(prz, NULL, 0); | ||
163 | |||
164 | *buf = kmalloc(size + ecc_notice_size + 1, GFP_KERNEL); | ||
160 | if (*buf == NULL) | 165 | if (*buf == NULL) |
161 | return -ENOMEM; | 166 | return -ENOMEM; |
162 | 167 | ||
163 | return size; | 168 | memcpy(*buf, persistent_ram_old(prz), size); |
169 | persistent_ram_ecc_string(prz, *buf + size, ecc_notice_size + 1); | ||
170 | |||
171 | return size + ecc_notice_size; | ||
164 | } | 172 | } |
165 | 173 | ||
166 | static size_t ramoops_write_kmsg_hdr(struct persistent_ram_zone *prz) | 174 | static size_t ramoops_write_kmsg_hdr(struct persistent_ram_zone *prz) |
diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c index c6f641c10179..59337326e288 100644 --- a/fs/pstore/ram_core.c +++ b/fs/pstore/ram_core.c | |||
@@ -235,6 +235,9 @@ ssize_t persistent_ram_ecc_string(struct persistent_ram_zone *prz, | |||
235 | { | 235 | { |
236 | ssize_t ret; | 236 | ssize_t ret; |
237 | 237 | ||
238 | if (!prz->ecc_info.ecc_size) | ||
239 | return 0; | ||
240 | |||
238 | if (prz->corrected_bytes || prz->bad_blocks) | 241 | if (prz->corrected_bytes || prz->bad_blocks) |
239 | ret = snprintf(str, len, "" | 242 | ret = snprintf(str, len, "" |
240 | "\n%d Corrected bytes, %d unrecoverable blocks\n", | 243 | "\n%d Corrected bytes, %d unrecoverable blocks\n", |