summaryrefslogtreecommitdiff
path: root/fs/pstore/platform.c
diff options
context:
space:
mode:
authorYue Hu <huyue2@yulong.com>2019-01-31 18:12:46 +0800
committerKees Cook <keescook@chromium.org>2019-02-12 12:09:49 -0800
commit4c6c4d34536744f2c9e171ef5bb548a06a525501 (patch)
treeb796fdf12b0b4b29b9490dd157c6e40a2f8cd92a /fs/pstore/platform.c
parent182ca6e0ae23550cf98d05daeab8dcb7fdc0a928 (diff)
pstore: Avoid writing records with zero size
Sometimes pstore_console_write() will write records with zero size to persistent ram zone, which is unnecessary. It will only increase resource consumption. Also adjust ramoops_write_kmsg_hdr() to have same logic if memory allocation fails. Signed-off-by: Yue Hu <huyue2@yulong.com> Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'fs/pstore/platform.c')
-rw-r--r--fs/pstore/platform.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 2d1066ed3c28..75887a269b64 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -501,6 +501,9 @@ static void pstore_console_write(struct console *con, const char *s, unsigned c)
{
struct pstore_record record;
+ if (!c)
+ return;
+
pstore_record_init(&record, psinfo);
record.type = PSTORE_TYPE_CONSOLE;