mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Geliang Tang <geliangtang@gmail.com>
To: Anton Vorontsov <anton@enomsg.org>,
	Colin Cross <ccross@android.com>,
	Kees Cook <keescook@chromium.org>,
	Tony Luck <tony.luck@intel.com>
Cc: Geliang Tang <geliangtang@gmail.com>, linux-kernel@vger.kernel.org
Subject: [PATCH] ramoops: add pdata NULL check to ramoops_probe
Date: Wed, 28 Sep 2016 18:32:38 +0800	[thread overview]
Message-ID: <1475058758-29877-1-git-send-email-geliangtang@gmail.com> (raw)

When the pdata is NULL, ramoops_probe() segfaults. So this patch adds
a NULL check to it.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
 fs/pstore/ram.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 6ad831b..dd9832d 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -576,6 +576,9 @@ static int ramoops_probe(struct platform_device *pdev)
 	if (cxt->max_dump_cnt)
 		goto fail_out;
 
+	if (!pdata)
+		goto fail_out;
+
 	if (!pdata->mem_size || (!pdata->record_size && !pdata->console_size &&
 			!pdata->ftrace_size && !pdata->pmsg_size)) {
 		pr_err("The memory size and the record/console size must be "
-- 
2.7.4

             reply	other threads:[~2016-09-28 10:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-28 10:32 Geliang Tang [this message]
2016-09-28 19:45 ` Kees Cook
2016-09-29 10:05   ` Geliang Tang
2016-11-16  0:31     ` Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1475058758-29877-1-git-send-email-geliangtang@gmail.com \
    --to=geliangtang@gmail.com \
    --cc=anton@enomsg.org \
    --cc=ccross@android.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®