summaryrefslogtreecommitdiffstats
path: root/fs/pstore
diff options
context:
space:
mode:
authorGeliang Tang <geliangtang@gmail.com>2016-08-30 14:24:42 +0200
committerKees Cook <keescook@chromium.org>2016-09-09 00:01:13 +0200
commitf88baf68ebe5b2efced64725fd98548af9b8f510 (patch)
tree5201d40100d0c6dedb3ed9244828804dfb682cb7 /fs/pstore
parentpstore/ram: Use memcpy_fromio() to save old buffer (diff)
downloadlinux-f88baf68ebe5b2efced64725fd98548af9b8f510.tar.xz
linux-f88baf68ebe5b2efced64725fd98548af9b8f510.zip
ramoops: move spin_lock_init after kmalloc error checking
If cxt->pstore.buf allocated failed, no need to initialize cxt->pstore.buf_lock. So this patch moves spin_lock_init() after the error checking. Signed-off-by: Geliang Tang <geliangtang@gmail.com> Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'fs/pstore')
-rw-r--r--fs/pstore/ram.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index f3e3cf00d8b9..6ad831b9d1b8 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -635,12 +635,12 @@ static int ramoops_probe(struct platform_device *pdev)
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);
- spin_lock_init(&cxt->pstore.buf_lock);
if (!cxt->pstore.buf) {
pr_err("cannot allocate pstore buffer\n");
err = -ENOMEM;
goto fail_clear;
}
+ spin_lock_init(&cxt->pstore.buf_lock);
cxt->pstore.flags = PSTORE_FLAGS_DMESG;
if (cxt->console_size)