Skip to contentSkip to conversation

spi: fsl-espi: avoid processing uninitalized data on error

PATCH In review Heiner Kallweit 2 participants 3 messages Oct 27, 2016 2 messages not in the archive SPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi: fsl-espi: avoid processing uninitalized data on error

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.

A functionally identical patch was submitted for stable already, however due to a merge conflict a separate patch is needed for next.

Fixes 6319a68011b8 ("spi/fsl-espi: avoid infinite loops on fsl_espi_cpu_irq()")
---
 drivers/spi/spi-fsl-espi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-fsl-espi.c +1 -1
index eea5123..4e8a99d 100644
@@ -455,7 +455,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) {
 			*(u32 *)mspi->rx = rx_data;
 			mspi->rx += 4;
 		}
Signature · 6 lines
2.10.1

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw
In reply to a message not in the archive
Quoted 3 lines · Heiner Kallweit

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.

#4 lore raw
In reply to a message not in the archive

Am 27.10.2016 um 12:14 schrieb Mark Brown:

Quoted 7 lines · Heiner Kallweit
Quoted 3 lines

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.

OK, I'll provide an updated one. I thought it was intended to replace Arnd's patch for next.

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