From: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Iain Baron <Iain.Baron-YmHWzhjmega9Zq0HfjR8jw@public.gmane.org>
Cc: "linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH] spi-altera: Fix NULL pointer dereference in spi_bitbang_transfer_one
Date: Wed, 3 Dec 2014 15:54:48 +0000 [thread overview]
Message-ID: <20141203155448.GA7712@sirena.org.uk> (raw)
In-Reply-To: <6438CE2D8332724FAD5D85EF6ED23E1912952563-ERkBUouPzqe8yxLPduiYWyEMcTpanLKPuOMsETyM3/Q@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 1623 bytes --]
On Wed, Dec 03, 2014 at 03:16:41PM +0000, Iain Baron wrote:
Please fix your mailer to word wrap within paragraphs so your mail is
legible.
> > If we can safely handle not having the callback then we should fix the
> > call site to safely handle a null pointer rather than adding dummy
> > callbacks. That way this is fixed once for all drivers that need it.
> Is it better to test for a null pointer at the spi-bitbang call-site,
> or get spi-bitbang to add a dummy callback of its own in
> spi_bitbang_start? The former has the overhead of a test every call,
> even for those drivers that provide the callback, while the latter has
> the overhead of a dummy call only for those drivers that don't.
If this is a valid thing to do it is better to have the test; if you
really want to avoid the test then the core needs to provide the default
implementation that users can reference.
> > I'd expect to see some code that checks to see if the caller is trying
> > to change paramters.
> If you mean in the spi-altera code: The spi-altera driver does not
> know what the hardware fixed parameters are, so it can't make a
> decision about whether the caller is trying to change them to
> something else.
> If you mean in the spi-bitbang code: The code appears to do this with
> the do_setup test, but it will always do a setup for the very first
> transfer in a message regardless, invoking the missing callback.
In some generic code. There's nothing device specific about a missing
callback. If the device does not know the initial settings we can at
least check that nothing is trying to change the settings later.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
prev parent reply other threads:[~2014-12-03 15:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-03 11:25 [PATCH] spi-altera: Fix NULL pointer dereference in spi_bitbang_transfer_one Iain Baron
[not found] ` <1417605949-11447-1-git-send-email-iain.baron-YmHWzhjmega9Zq0HfjR8jw@public.gmane.org>
2014-12-03 13:03 ` Mark Brown
[not found] ` <20141203130324.GY7712-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-12-03 15:16 ` Iain Baron
[not found] ` <6438CE2D8332724FAD5D85EF6ED23E1912952563-ERkBUouPzqe8yxLPduiYWyEMcTpanLKPuOMsETyM3/Q@public.gmane.org>
2014-12-03 15:54 ` Mark Brown [this message]
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=20141203155448.GA7712@sirena.org.uk \
--to=broonie-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
--cc=Iain.Baron-YmHWzhjmega9Zq0HfjR8jw@public.gmane.org \
--cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@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).