summaryrefslogtreecommitdiffstats
path: root/fs/pstore/ram.c
diff options
context:
space:
mode:
authorKees Cook2018-12-04 01:52:02 +0100
committerKees Cook2018-12-04 01:52:02 +0100
commit971f66d8a75a4f86a254652cc1e70a7be841cc43 (patch)
treeeb40985c760e9824e902e19794b6cd839264f863 /fs/pstore/ram.c
parentLinux 4.20-rc2 (diff)
parentpstore/ram: Correctly calculate usable PRZ bytes (diff)
downloadkernel-qcow2-linux-971f66d8a75a4f86a254652cc1e70a7be841cc43.tar.gz
kernel-qcow2-linux-971f66d8a75a4f86a254652cc1e70a7be841cc43.tar.xz
kernel-qcow2-linux-971f66d8a75a4f86a254652cc1e70a7be841cc43.zip
Merge branch 'for-linus/pstore' into for-next/pstore
Diffstat (limited to 'fs/pstore/ram.c')
-rw-r--r--fs/pstore/ram.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index ffcff6516e89..e02a9039b5ea 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -816,17 +816,14 @@ static int ramoops_probe(struct platform_device *pdev)
cxt->pstore.data = cxt;
/*
- * Console can handle any buffer size, so prefer LOG_LINE_MAX. If we
- * have to handle dumps, we must have at least record_size buffer. And
- * for ftrace, bufsize is irrelevant (if bufsize is 0, buf will be
- * ZERO_SIZE_PTR).
+ * Since bufsize is only used for dmesg crash dumps, it
+ * must match the size of the dprz record (after PRZ header
+ * and ECC bytes have been accounted for).
*/
- if (cxt->console_size)
- cxt->pstore.bufsize = 1024; /* LOG_LINE_MAX */
- cxt->pstore.bufsize = max(cxt->record_size, cxt->pstore.bufsize);
- cxt->pstore.buf = kmalloc(cxt->pstore.bufsize, GFP_KERNEL);
+ cxt->pstore.bufsize = cxt->dprzs[0]->buffer_size;
+ cxt->pstore.buf = kzalloc(cxt->pstore.bufsize, GFP_KERNEL);
if (!cxt->pstore.buf) {
- pr_err("cannot allocate pstore buffer\n");
+ pr_err("cannot allocate pstore crash dump buffer\n");
err = -ENOMEM;
goto fail_clear;
}