[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdXqvLAH6NJduThQ54Ygi91A53huUHgG0jtOtrjxyagthw@mail.gmail.com>
Date: Mon, 30 Jan 2017 11:00:28 +0100
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Shailendra Verma <shailendra.v@...sung.com>
Cc: Mark Brown <broonie@...nel.org>,
linux-spi <linux-spi@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
p.shailesh@...sung.com, ashish.kalra@...sung.com,
Shailendra Verma <shailendra.capricorn@...il.com>
Subject: Re: [PATCH] spi - Fix possible NULL derefrence.
Hi Shailendra,
On Mon, Jan 30, 2017 at 5:55 AM, Shailendra Verma
<shailendra.v@...sung.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@...sung.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@...ux-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
Powered by blists - more mailing lists