From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Shailendra Verma <shailendra.v@samsung.com>
Cc: Mark Brown <broonie@kernel.org>,
linux-spi <linux-spi@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
p.shailesh@samsung.com, ashish.kalra@samsung.com,
Shailendra Verma <shailendra.capricorn@gmail.com>
Subject: Re: [PATCH] spi - Fix possible NULL derefrence.
Date: Mon, 30 Jan 2017 11:00:28 +0100 [thread overview]
Message-ID: <CAMuHMdXqvLAH6NJduThQ54Ygi91A53huUHgG0jtOtrjxyagthw@mail.gmail.com> (raw)
In-Reply-To: <1485752113-29581-1-git-send-email-shailendra.v@samsung.com>
Hi Shailendra,
On Mon, Jan 30, 2017 at 5:55 AM, Shailendra Verma
<shailendra.v@samsung.com> wrote:
> of_match_device could return NULL, and so can cause a NULL
> pointer dereference later.
Can it? The driver uses DT exclusively.
There is no legacy platform code creating "mxs-spi" platform devices.
> Signed-off-by: Shailendra Verma <shailendra.v@samsung.com>
> ---
> drivers/spi/spi-mxs.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c
> index 5b0e9a3..c3aea7e 100644
> --- a/drivers/spi/spi-mxs.c
> +++ b/drivers/spi/spi-mxs.c
> @@ -470,6 +470,11 @@ static int mxs_spi_probe(struct platform_device *pdev)
> */
> const int clk_freq_default = 160000000;
>
> + if (!of_id) {
> + dev_err(&pdev->dev, "Error: No device match found\n");
> + return -ENODEV;
> + }
> +
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
next prev parent reply other threads:[~2017-01-30 10:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20170130045527epcas2p18ca90e9cd6b0a6153bf941eec4f40ddf@epcas2p1.samsung.com>
2017-01-30 4:55 ` [PATCH] spi - Fix possible NULL derefrence Shailendra Verma
2017-01-30 10:00 ` Geert Uytterhoeven [this message]
2017-01-30 12:52 ` Mark Brown
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=CAMuHMdXqvLAH6NJduThQ54Ygi91A53huUHgG0jtOtrjxyagthw@mail.gmail.com \
--to=geert@linux-m68k.org \
--cc=ashish.kalra@samsung.com \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=p.shailesh@samsung.com \
--cc=shailendra.capricorn@gmail.com \
--cc=shailendra.v@samsung.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;
as well as URLs for NNTP newsgroup(s).