All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Shailendra Verma <shailendra.v@samsung.com>
Cc: Richard Weinberger <richard@nod.at>,
	David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Marek Vasut <marek.vasut@gmail.com>,
	Cyrille Pitchen <cyrille.pitchen@atmel.com>,
	Stefan Agner <stefan@agner.ch>,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
	p.shailesh@samsung.com, ashish.kalra@samsung.com,
	Shailendra Verma <shailendra.capricorn@gmail.com>
Subject: Re: [PATCH] Mtd: nand - Fix possible NULL derefrence.
Date: Mon, 30 Jan 2017 08:56:17 +0100	[thread overview]
Message-ID: <20170130085617.6a48ddfb@bbrezillon> (raw)
In-Reply-To: <1485752357-29817-1-git-send-email-shailendra.v@samsung.com>

Hi Shailendra,

Marek and I already reviewed this patch, and you're resending it
without any of the comments addressed. Is this a mistake?

On Mon, 30 Jan 2017 10:29:17 +0530
Shailendra Verma <shailendra.v@samsung.com> wrote:

> of_match_device could return NULL, and so can cause a NULL
> pointer dereference later.
> 
> Signed-off-by: Shailendra Verma <shailendra.v@samsung.com>
> ---
>  drivers/mtd/nand/mxc_nand.c  |    4 ++++
>  drivers/mtd/nand/vf610_nfc.c |    4 ++++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
> index d7f724b..ca1b8ad 100644
> --- a/drivers/mtd/nand/mxc_nand.c
> +++ b/drivers/mtd/nand/mxc_nand.c
> @@ -1596,6 +1596,10 @@ static int __init mxcnd_probe_dt(struct mxc_nand_host *host)
>  	if (!np)
>  		return 1;
>  
> +	if (!of_id) {
> +		dev_err(host->dev, "Error: No device match found\n");
> +		return -ENODEV;
> +	}
>  	host->devtype_data = of_id->data;
>  
>  	return 0;
> diff --git a/drivers/mtd/nand/vf610_nfc.c b/drivers/mtd/nand/vf610_nfc.c
> index 3ad514c..0e09c11 100644
> --- a/drivers/mtd/nand/vf610_nfc.c
> +++ b/drivers/mtd/nand/vf610_nfc.c
> @@ -674,6 +674,10 @@ static int vf610_nfc_probe(struct platform_device *pdev)
>  	}
>  
>  	of_id = of_match_device(vf610_nfc_dt_ids, &pdev->dev);
> +	if (!of_id) {
> +		dev_err(&pdev->dev, "Error: No device match found\n");
> +		return -ENODEV;
> +	}
>  	nfc->variant = (enum vf610_nfc_variant)of_id->data;
>  
>  	for_each_available_child_of_node(nfc->dev->of_node, child) {

  reply	other threads:[~2017-01-30  8:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170130045947epcas4p48c244819af3cad2c5f1f8120192611d2@epcas4p4.samsung.com>
2017-01-30  4:59 ` [PATCH] Mtd: nand - Fix possible NULL derefrence Shailendra Verma
2017-01-30  7:56   ` Boris Brezillon [this message]
     [not found] <CGME20170130044701epcas2p327897c254334e190e982c208de1c034c@epcas2p3.samsung.com>
2017-01-30  4:46 ` Shailendra Verma
     [not found] <CGME20170127112921epcas1p45999b22222202e8d98b6aecfc3cbeb39@epcas1p4.samsung.com>
2017-01-27 11:29 ` Shailendra Verma
2017-01-27 12:24   ` Marek Vasut
2017-01-27 12:44     ` Boris Brezillon

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=20170130085617.6a48ddfb@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=ashish.kalra@samsung.com \
    --cc=computersforpeace@gmail.com \
    --cc=cyrille.pitchen@atmel.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=p.shailesh@samsung.com \
    --cc=richard@nod.at \
    --cc=shailendra.capricorn@gmail.com \
    --cc=shailendra.v@samsung.com \
    --cc=stefan@agner.ch \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.