linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
To: Steven King <sfking-xS0NTnu2YfYAvxtiuMwx3w@public.gmane.org>
Cc: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>,
	Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	linux-spi <linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH] spi: coldfire-qspi: Prevent NULL pointer dereference
Date: Mon, 10 Mar 2014 17:06:35 +0100	[thread overview]
Message-ID: <CAMuHMdVNE8XHJSurVJ-o0E6oD5+5ZxLeA5Pjr8QMMFkBHCV2yw@mail.gmail.com> (raw)
In-Reply-To: <201403100904.05819.sfking-xS0NTnu2YfYAvxtiuMwx3w@public.gmane.org>

On Mon, Mar 10, 2014 at 5:04 PM, Steven King <sfking-xS0NTnu2YfYAvxtiuMwx3w@public.gmane.org> wrote:
> On Saturday 08 March 2014 10:11:10 pm Axel Lin wrote:
>> If pdata->cs_control is NULL, we will hit NULL pointer dereference in
>> mcfqspi_cs_select() and mcfqspi_cs_deselect(). Thus add NULL test for
>> pdata->cs_control in probe().
>
> D'oh!  My bad.  Actually you're right there would be a NULL pointer
> dereference in cs_select and cs_deselect  (I was looking at the cs_setup and
> cs_teardown in the patch) and so cs_control must not be NULL.  Thats want I
> get for replying before I've had my coffee and when I haven't looked at the
> code in awhile.  So yeah, the patch is GTG.

I had the same first impression. But after looking through the code, the
changes is fine. Furthermore, there's only on in-tree user it, which does
provide cs_control.

There's more opportunity for cleanup, though, as cs_control provides control
of a GPIO, which can be handled by the SPI core, too.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.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
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2014-03-10 16:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-09  6:11 [PATCH] spi: coldfire-qspi: Prevent NULL pointer dereference Axel Lin
2014-03-10 15:48 ` Steven King
     [not found]   ` <201403100848.41186.sfking-xS0NTnu2YfYAvxtiuMwx3w@public.gmane.org>
2014-03-10 16:05     ` Mark Brown
2014-03-10 16:04 ` Steven King
     [not found]   ` <201403100904.05819.sfking-xS0NTnu2YfYAvxtiuMwx3w@public.gmane.org>
2014-03-10 16:06     ` Geert Uytterhoeven [this message]
2014-03-10 16:08     ` 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=CAMuHMdVNE8XHJSurVJ-o0E6oD5+5ZxLeA5Pjr8QMMFkBHCV2yw@mail.gmail.com \
    --to=geert-td1emuhucqxl1znqvxdv9g@public.gmane.org \
    --cc=axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sfking-xS0NTnu2YfYAvxtiuMwx3w@public.gmane.org \
    /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).