Re: [PATCH] spi: Skip zero-length transfers in spi_transfer_one_message()

2021-02-12 Thread Mark Brown
On Thu, 11 Feb 2021 19:08:20 +0100, Nicolas Saenz Julienne wrote: > With the introduction of 26751de25d25 ("spi: bcm2835: Micro-optimise > FIFO loops") it has become apparent that some users might initiate > zero-length SPI transfers. A fact the micro-optimization omitted, and > which turned out to

Re: [PATCH] spi: Skip zero-length transfers in spi_transfer_one_message()

2021-02-12 Thread Mark Brown
On Fri, Feb 12, 2021 at 01:57:24PM +0100, Geert Uytterhoeven wrote: > On Fri, Feb 12, 2021 at 1:55 PM Mark Brown wrote: > > 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 twea

Re: [PATCH] spi: Skip zero-length transfers in spi_transfer_one_message()

2021-02-12 Thread Geert Uytterhoeven
Hi Mark, On Fri, Feb 12, 2021 at 1:55 PM Mark Brown wrote: > On Fri, Feb 12, 2021 at 01:48:21PM +0100, Nicolas Saenz Julienne wrote: > > On Fri, 2021-02-12 at 12:31 +, Mark Brown wrote: > > > On Thu, Feb 11, 2021 at 07:08:20PM +0100, Nicolas Saenz Julienne wrote: > > > > > - if (xfer-

Re: [PATCH] spi: Skip zero-length transfers in spi_transfer_one_message()

2021-02-12 Thread Mark Brown
On Fri, Feb 12, 2021 at 01:48:21PM +0100, Nicolas Saenz Julienne wrote: > On Fri, 2021-02-12 at 12:31 +, 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->

Re: [PATCH] spi: Skip zero-length transfers in spi_transfer_one_message()

2021-02-12 Thread Nicolas Saenz Julienne
On Fri, 2021-02-12 at 12:31 +, 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 user

Re: [PATCH] spi: Skip zero-length transfers in spi_transfer_one_message()

2021-02-12 Thread Mark Brown
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 abo

[PATCH] spi: Skip zero-length transfers in spi_transfer_one_message()

2021-02-11 Thread Nicolas Saenz Julienne
With the introduction of 26751de25d25 ("spi: bcm2835: Micro-optimise FIFO loops") it has become apparent that some users might initiate zero-length SPI transfers. A fact the micro-optimization omitted, and which turned out to cause crashes[1]. Instead of changing the micro-optimization itself, use