From patchwork Mon Oct 17 22:13:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101674 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp596817qge; Mon, 17 Oct 2016 15:16:10 -0700 (PDT) X-Received: by 10.98.82.75 with SMTP id g72mr40412354pfb.119.1476742570282; Mon, 17 Oct 2016 15:16:10 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o127si29019447pga.74.2016.10.17.15.16.10 for ; Mon, 17 Oct 2016 15:16:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-spi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755806AbcJQWQD (ORCPT ); Mon, 17 Oct 2016 18:16:03 -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 Received: from wuerfel.lan. ([78.43.20.153]) by mrelayeu.kundenserver.de (mreue004) with ESMTPA (Nemesis) id 0MXTpy-1cQULR1C9W-00WXEL; Tue, 18 Oct 2016 00:15:11 +0200 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-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org 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(-) -- 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 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); }