Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758762AbcJQWQM (ORCPT ); Mon, 17 Oct 2016 18:16:12 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:64383 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755736AbcJQWPv (ORCPT ); Mon, 17 Oct 2016 18:15:51 -0400 From: Arnd Bergmann To: Mark Brown Cc: Linus Torvalds , linux-kernel@vger.kernel.org, Arnd Bergmann , Heiner Kallweit , Nobuteru Hayashi , linux-spi@vger.kernel.org Subject: [PATCH 17/28] spi: fsl-espi: avoid processing uninitalized data on error Date: Tue, 18 Oct 2016 00:13:38 +0200 Message-Id: <20161017221355.1861551-5-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20161017220342.1627073-1-arnd@arndb.de> References: <20161017220342.1627073-1-arnd@arndb.de> X-Provags-ID: V03:K0:rokaZ/Po0+wYpl0FlSzVGhpiU9cVBLni5ELlWlBcoK+jO7tORyv 9UK9BDA12Pli5lxSaj7PEcDGMXSwiMb/ni4LN2P8Vu3M1z23UTkH+I/YE4zOWIYb1uylRJo IN3geDXTmpcDbP9TlhwROTG6Pg5xKr51pml8H9GY7H8eDlwwtCyeb9yV6X6/ZRS09spTPtq WJqdOLPNFpzSeZ7ZlzBWw== X-UI-Out-Filterresults: notjunk:1;V01:K0:9Q3iAq08sE4=:6ZBrmL+iCVwQ+GFq1RrxNI yGScp8mZZVAKhMfW2/MrjzSpLAnuqwoYuDFbFbyagnypQD5z5bbBHInNs9mx8ha5PzaMxdy+z 7lbfWE/wX6lbHoaCxpv3aRBOSqdlDLqo49/PK6yIUgM6k/AHkLu/7q2RWokC2mbVVzRJAXw7Q 7s5GuEXIjFJ6CuZn6SHuV1uZUfo3Q+NTt+alj/hpskVVHa1hYluti/rmjH7qgij8CK5dGN8/9 lakUrf0kMoNACuxEKfK3GCGa2EPARbqNAUR9EM0gitHVXCDbSBH4BeJbk20ITPMIEspUzX0RT aOUGeMVoqZPMdKky7FMI8VJ/+K+9L3fwQp+QjbFS1JYjTiUeYCrS4sSP2jsHpVGq6jL0Bn34H TsvkX68Xwxf5g1AJhdVM/bn5qBz/asb6tdk1GZBgMRxz2bAFsTbgHpC/2m2tiYIB5lOMEQu6C W9nKNkWnxK1lsgaXlF3RgguKy25yqOffL3D2y8kw1/m7NGfYEvH36sfy7s7uZ15O4OeQf8wjJ Tx/0bNSYQZLp3R4viIb7Ad3cbtbNchSRjxyhOOfjjiCJv2GpgEWutsezGDrdXFdb4P4laF26Z fdHnLTgp3yp0hyu3RgbGz7a/z8E3xLEHZ6yWyvw1TxzjrNIzThxRYZN2TTTOYx/jMHyckYKk/ 0mf5SjJlzLGFsYJf5oXNRj+H0Ad6bKt+BVMYUeAhAakn6luek2Q82iXsDHkR2TVSX9M4= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 896 Lines: 29 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 --- drivers/spi/spi-fsl-espi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); } -- 2.9.0