summaryrefslogtreecommitdiffstats
path: root/fs/pstore/ram.c
diff options
context:
space:
mode:
authorArve Hjønnevåg <arve@android.com>2012-12-05 21:19:51 -0800
committerAnton Vorontsov <anton@enomsg.org>2013-04-03 21:50:10 -0700
commitbd08ec33b5c23833581e5a36b2a69ccae6b39a28 (patch)
tree36da2618929a667d13b1a9408c2e9427cf32456c /fs/pstore/ram.c
parentc31ad081e8734aab3fb45d2f32e9969994dd076e (diff)
downloadop-kernel-dev-bd08ec33b5c23833581e5a36b2a69ccae6b39a28.zip
op-kernel-dev-bd08ec33b5c23833581e5a36b2a69ccae6b39a28.tar.gz
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>
Diffstat (limited to 'fs/pstore/ram.c')
-rw-r--r--fs/pstore/ram.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index a5ee252..32cbd7c 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,
char **buf, struct pstore_info *psi)
{
ssize_t size;
+ ssize_t ecc_notice_size;
struct ramoops_context *cxt = psi->data;
struct persistent_ram_zone *prz;
@@ -156,11 +157,18 @@ static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type,
time->tv_nsec = 0;
size = persistent_ram_old_size(prz);
- *buf = kmemdup(persistent_ram_old(prz), size, GFP_KERNEL);
+
+ /* ECC correction notice */
+ ecc_notice_size = persistent_ram_ecc_string(prz, NULL, 0);
+
+ *buf = kmalloc(size + ecc_notice_size + 1, GFP_KERNEL);
if (*buf == NULL)
return -ENOMEM;
- return size;
+ memcpy(*buf, persistent_ram_old(prz), size);
+ persistent_ram_ecc_string(prz, *buf + size, ecc_notice_size + 1);
+
+ return size + ecc_notice_size;
}
static size_t ramoops_write_kmsg_hdr(struct persistent_ram_zone *prz)
OpenPOWER on IntegriCloud