]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
spi: fsl-espi: avoid processing uninitalized data on error
authorArnd Bergmann <arnd@arndb.de>
Tue, 25 Oct 2016 20:57:10 +0000 (22:57 +0200)
committerMark Brown <broonie@kernel.org>
Wed, 26 Oct 2016 10:14:52 +0000 (11:14 +0100)
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.

Fixes: 6319a68011b8 ("spi/fsl-espi: avoid infinite loops on fsl_espi_cpu_irq()")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
drivers/spi/spi-fsl-espi.c

index 7451585a080e5ccc13e2fc59d532c70e786a4ce0..2c175b9495f7ee102a0d70a96f42fa730c019247 100644 (file)
@@ -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);
        }