[17/28] spi: fsl-espi: avoid processing uninitalized data on error

Message ID 20161017221355.1861551-5-arnd@arndb.de
State New
Headers show
Series
  • Untitled series #1817
Related show

Commit Message

Arnd Bergmann Oct. 17, 2016, 10:13 p.m.
When we get a spurious interrupt in fsl_espi_irq, we end up
processing four uninitalized bytes of data, as shown in this
warning message:

   drivers/spi/spi-fsl-espi.c: In function 'fsl_espi_irq':
   drivers/spi/spi-fsl-espi.c:462:4: warning: 'rx_data' may be used uninitialized in this function [-Wmaybe-uninitialized]

This adds another check so we skip the data in this case.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

---
 drivers/spi/spi-fsl-espi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.9.0

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Mark Brown Oct. 24, 2016, 5:27 p.m. | #1
On Tue, Oct 18, 2016 at 12:13:38AM +0200, Arnd Bergmann wrote:
> When we get a spurious interrupt in fsl_espi_irq, we end up

> processing four uninitalized bytes of data, as shown in this

> warning message:


This doesn't apply against current code, please check and resend.
Heiner Kallweit Oct. 24, 2016, 6:36 p.m. | #2
Am 24.10.2016 um 19:27 schrieb Mark Brown:
> On Tue, Oct 18, 2016 at 12:13:38AM +0200, Arnd Bergmann wrote:

>> When we get a spurious interrupt in fsl_espi_irq, we end up

>> processing four uninitalized bytes of data, as shown in this

>> warning message:

> 

> This doesn't apply against current code, please check and resend.

> 

The not yet reviewed part of my patch series from Oct 2nd,
namely "[PATCH 07/11] spi: fsl-espi: fix and improve reading
from RX FIFO" replaces the code in question.
There's more to fix like removing polling from the ISR.
If you prefer to apply Arnd's fix first I'd rebase the open part
of the patch series and resend it.

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mark Brown Oct. 24, 2016, 6:45 p.m. | #3
On Mon, Oct 24, 2016 at 08:36:37PM +0200, Heiner Kallweit wrote:
> Am 24.10.2016 um 19:27 schrieb Mark Brown:


> > This doesn't apply against current code, please check and resend.


> The not yet reviewed part of my patch series from Oct 2nd,

> namely "[PATCH 07/11] spi: fsl-espi: fix and improve reading

> from RX FIFO" replaces the code in question.

> There's more to fix like removing polling from the ISR.

> If you prefer to apply Arnd's fix first I'd rebase the open part

> of the patch series and resend it.


If there are dependencies you should mention them when you resend (in
general you should always mention any unapplied or cross tree
dependencies when sending things).

Patch hide | download patch | download mbox

diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c
index 7451585..2c175b9 100644
--- a/drivers/spi/spi-fsl-espi.c
+++ b/drivers/spi/spi-fsl-espi.c
@@ -458,7 +458,7 @@  static void fsl_espi_cpu_irq(struct mpc8xxx_spi *mspi, u32 events)
 
 		mspi->len -= rx_nr_bytes;
 
-		if (mspi->rx)
+		if (rx_nr_bytes && mspi->rx)
 			mspi->get_rx(rx_data, mspi);
 	}