Commit bd08ec33b5c23833581e5a36b2a69ccae6b39a28
Committed by
Anton Vorontsov
1 parent
c31ad081e8
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
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>
Showing 2 changed files with 13 additions and 2 deletions Side-by-side Diff
fs/pstore/ram.c
... | ... | @@ -136,6 +136,7 @@ |
136 | 136 | char **buf, struct pstore_info *psi) |
137 | 137 | { |
138 | 138 | ssize_t size; |
139 | + ssize_t ecc_notice_size; | |
139 | 140 | struct ramoops_context *cxt = psi->data; |
140 | 141 | struct persistent_ram_zone *prz; |
141 | 142 | |
142 | 143 | |
... | ... | @@ -156,11 +157,18 @@ |
156 | 157 | time->tv_nsec = 0; |
157 | 158 | |
158 | 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 | 165 | if (*buf == NULL) |
161 | 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 | 174 | static size_t ramoops_write_kmsg_hdr(struct persistent_ram_zone *prz) |
fs/pstore/ram_core.c