diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index cb8deb69529e..98f37312c0ce 100755 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c @@ -448,6 +448,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;