From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752869AbcI1KdS (ORCPT ); Wed, 28 Sep 2016 06:33:18 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:34623 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751769AbcI1KdK (ORCPT ); Wed, 28 Sep 2016 06:33:10 -0400 From: Geliang Tang To: Anton Vorontsov , Colin Cross , Kees Cook , Tony Luck Cc: Geliang Tang , linux-kernel@vger.kernel.org Subject: [PATCH] ramoops: add pdata NULL check to ramoops_probe Date: Wed, 28 Sep 2016 18:32:38 +0800 Message-Id: <1475058758-29877-1-git-send-email-geliangtang@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When the pdata is NULL, ramoops_probe() segfaults. So this patch adds a NULL check to it. Signed-off-by: Geliang Tang --- 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