All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Cc: Robin Murphy <robin.murphy@arm.com>,
	Phil Elwell <phil@raspberrypi.com>,
	linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] spi: Skip zero-length transfers in spi_transfer_one_message()
Date: Fri, 12 Feb 2021 12:52:21 +0000	[thread overview]
Message-ID: <20210212125221.GD6057@sirena.org.uk> (raw)
In-Reply-To: <cd41a204107900c890b0234847fa0b62701f74cc.camel@suse.de>

[-- Attachment #1: Type: text/plain, Size: 1052 bytes --]

On Fri, Feb 12, 2021 at 01:48:21PM +0100, Nicolas Saenz Julienne wrote:
> On Fri, 2021-02-12 at 12:31 +0000, Mark Brown wrote:
> > On Thu, Feb 11, 2021 at 07:08:20PM +0100, Nicolas Saenz Julienne wrote:

> > > -		if (xfer->tx_buf || xfer->rx_buf) {
> > > +		if ((xfer->tx_buf || xfer->rx_buf) && xfer->len) {

> > I think the issue here is more that some users were passing in buffers
> > with zero length transfers, the above check was already intended to
> > catch this case but was working on the assumption that if there was
> > nothing to transfer then no buffer would be provided.

> Fair enough, maybe it makes sense to move the check into __spi_validate() and
> propagate an error upwards?

No, I think it's fine - there's probably some sensible use case with
drivers reusing a statically allocated transfer/buffer set for multiple
operations and just tweaking the length as needed which seems a bit
weird but I can't think of a reason not to allow it.  Your patch is
currently queued, all being well it'll get tested & pushed out later
today.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2021-02-12 13:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-11 18:08 [PATCH] spi: Skip zero-length transfers in spi_transfer_one_message() Nicolas Saenz Julienne
2021-02-12 12:31 ` Mark Brown
2021-02-12 12:48   ` Nicolas Saenz Julienne
2021-02-12 12:52     ` Mark Brown [this message]
2021-02-12 12:57       ` Geert Uytterhoeven
2021-02-12 13:05         ` Mark Brown
2021-02-12 14:01 ` 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=20210212125221.GD6057@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=nsaenzjulienne@suse.de \
    --cc=phil@raspberrypi.com \
    --cc=robin.murphy@arm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.