summary refs log tree commit diff
path: root/fs/pstore/ram.c
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2018-12-03 16:52:02 -0800
committerKees Cook <keescook@chromium.org>2018-12-03 16:52:02 -0800
commit971f66d8a75a4f86a254652cc1e70a7be841cc43 (patch)
treeeb40985c760e9824e902e19794b6cd839264f863 /fs/pstore/ram.c
parentccda4af0f4b92f7b4c308d3acc262f4a7e3affad (diff)
parent89d328f637b9904b6d4c9af73c8a608b8dd4d6f8 (diff)
downloadlinux-971f66d8a75a4f86a254652cc1e70a7be841cc43.tar.gz
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;
 	}