mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
Cc: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>,
	patches@opensource.wolfsonmicro.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] mfd: wm831x: add null check before pointer dereference
Date: Wed, 24 May 2017 11:52:16 +0100	[thread overview]
Message-ID: <20170524105216.5j2byctru7wbs5zd@dell> (raw)
In-Reply-To: <20170524091852.GA7702@embeddedgus>

On Wed, 24 May 2017, Gustavo A. R. Silva wrote:

> Add NULL check before dereferencing pointer of_id in order to avoid
> a potential NULL pointer dereference.
> 
> Addresses-Coverity-ID: 1408830
> Cc: Lee Jones <lee.jones@linaro.org>
> Cc: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
> ---
> Changes in v2:
>  Update error log and return value.
> 
>  drivers/mfd/wm831x-spi.c | 4 ++++
>  1 file changed, 4 insertions(+)

Applied, thanks.

> diff --git a/drivers/mfd/wm831x-spi.c b/drivers/mfd/wm831x-spi.c
> index c332e28..018ce65 100644
> --- a/drivers/mfd/wm831x-spi.c
> +++ b/drivers/mfd/wm831x-spi.c
> @@ -34,6 +34,10 @@ static int wm831x_spi_probe(struct spi_device *spi)
>  
>  	if (spi->dev.of_node) {
>  		of_id = of_match_device(wm831x_of_match, &spi->dev);
> +		if (!of_id) {
> +			dev_err(&spi->dev, "Failed to match device\n");
> +			return -ENODEV;
> +		}
>  		type = (enum wm831x_parent)of_id->data;
>  	} else {
>  		type = (enum wm831x_parent)id->driver_data;

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

  reply	other threads:[~2017-05-24 10:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-23 21:33 [mfd] question about potential null " Gustavo A. R. Silva
2017-05-24  7:22 ` Lee Jones
2017-05-24  8:09   ` Charles Keepax
2017-05-24  8:19     ` Gustavo A. R. Silva
2017-05-24  8:27       ` [PATCH] mfd: add null check before " Gustavo A. R. Silva
2017-05-24  8:41         ` Charles Keepax
2017-05-24  8:43         ` Lee Jones
2017-05-24  8:50           ` Gustavo A. R. Silva
2017-05-24  9:18             ` [PATCH v2] mfd: wm831x: " Gustavo A. R. Silva
2017-05-24 10:52               ` Lee Jones [this message]
2017-05-24  8:37 [PATCH] mfd: " Gustavo A. R. Silva
2017-05-24  9:26 ` [PATCH v2] mfd: wm831x: " Gustavo A. R. Silva
2017-05-24 10:51   ` Lee Jones

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=20170524105216.5j2byctru7wbs5zd@dell \
    --to=lee.jones@linaro.org \
    --cc=ckeepax@opensource.wolfsonmicro.com \
    --cc=garsilva@embeddedor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@opensource.wolfsonmicro.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®