diff options
author | Geliang Tang <geliangtang@gmail.com> | 2016-08-30 08:24:42 -0400 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2016-09-08 18:01:13 -0400 |
commit | f88baf68ebe5b2efced64725fd98548af9b8f510 (patch) | |
tree | 5201d40100d0c6dedb3ed9244828804dfb682cb7 | |
parent | d771fdf94180de2bd811ac90cba75f0f346abf8d (diff) |
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>
-rw-r--r-- | fs/pstore/ram.c | 2 |
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) | |||
635 | cxt->pstore.bufsize = 1024; /* LOG_LINE_MAX */ | 635 | cxt->pstore.bufsize = 1024; /* LOG_LINE_MAX */ |
636 | cxt->pstore.bufsize = max(cxt->record_size, cxt->pstore.bufsize); | 636 | cxt->pstore.bufsize = max(cxt->record_size, cxt->pstore.bufsize); |
637 | cxt->pstore.buf = kmalloc(cxt->pstore.bufsize, GFP_KERNEL); | 637 | cxt->pstore.buf = kmalloc(cxt->pstore.bufsize, GFP_KERNEL); |
638 | spin_lock_init(&cxt->pstore.buf_lock); | ||
639 | if (!cxt->pstore.buf) { | 638 | if (!cxt->pstore.buf) { |
640 | pr_err("cannot allocate pstore buffer\n"); | 639 | pr_err("cannot allocate pstore buffer\n"); |
641 | err = -ENOMEM; | 640 | err = -ENOMEM; |
642 | goto fail_clear; | 641 | goto fail_clear; |
643 | } | 642 | } |
643 | spin_lock_init(&cxt->pstore.buf_lock); | ||
644 | 644 | ||
645 | cxt->pstore.flags = PSTORE_FLAGS_DMESG; | 645 | cxt->pstore.flags = PSTORE_FLAGS_DMESG; |
646 | if (cxt->console_size) | 646 | if (cxt->console_size) |