Re: [PATCH] spi - Fix possible NULL derefrence.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Shailendra,

On Mon, Jan 30, 2017 at 5:55 AM, Shailendra Verma
<shailendra.v@xxxxxxxxxxx> 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@xxxxxxxxxxx>
> ---
>  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@xxxxxxxxxxxxxx

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
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux