summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fs/pstore/ram.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index d06e2f3e3bec..ec0e1da0596a 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -425,6 +425,9 @@ static int notrace ramoops_pstore_write(struct pstore_record *record)
/* Build header and append record contents. */
hlen = ramoops_write_kmsg_hdr(prz, record);
+ if (!hlen)
+ return -ENOMEM;
+
size = record->size;
if (size + hlen > prz->buffer_size)
size = prz->buffer_size - hlen;