From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:38412 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752426AbbJQThq (ORCPT ); Sat, 17 Oct 2015 15:37:46 -0400 Subject: Patch "spi: bcm2835: BUG: fix wrong use of PAGE_MASK" has been added to the 4.2-stable tree To: kernel@martin.sperl.org, broonie@kernel.org, gregkh@linuxfoundation.org, robert@axium.co.nz Cc: , From: Date: Sat, 17 Oct 2015 12:37:45 -0700 Message-ID: <14451106655515@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: This is a note to let you know that I've just added the patch titled spi: bcm2835: BUG: fix wrong use of PAGE_MASK to the 4.2-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: spi-bcm2835-bug-fix-wrong-use-of-page_mask.patch and it can be found in the queue-4.2 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >>From 2a3fffd45822070309bcf0b1e1dae624d633824a Mon Sep 17 00:00:00 2001 From: Martin Sperl Date: Thu, 10 Sep 2015 09:32:14 +0000 Subject: spi: bcm2835: BUG: fix wrong use of PAGE_MASK From: Martin Sperl commit 2a3fffd45822070309bcf0b1e1dae624d633824a upstream. There is a bug in the alignment checking of transfers, that results in DMA not being used for un-aligned transfers that do not cross page-boundries, which is valid. This is due to a missconception of the meaning PAGE_MASK when implementing that check originally - (PAGE_SIZE - 1) should have been used instead. Also fixes a copy/paste error. Reported-by: Signed-off-by: Martin Sperl Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- drivers/spi/spi-bcm2835.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/spi/spi-bcm2835.c +++ b/drivers/spi/spi-bcm2835.c @@ -386,14 +386,14 @@ static bool bcm2835_spi_can_dma(struct s /* otherwise we only allow transfers within the same page * to avoid wasting time on dma_mapping when it is not practical */ - if (((size_t)tfr->tx_buf & PAGE_MASK) + tfr->len > PAGE_SIZE) { + if (((size_t)tfr->tx_buf & (PAGE_SIZE - 1)) + tfr->len > PAGE_SIZE) { dev_warn_once(&spi->dev, "Unaligned spi tx-transfer bridging page\n"); return false; } - if (((size_t)tfr->rx_buf & PAGE_MASK) + tfr->len > PAGE_SIZE) { + if (((size_t)tfr->rx_buf & (PAGE_SIZE - 1)) + tfr->len > PAGE_SIZE) { dev_warn_once(&spi->dev, - "Unaligned spi tx-transfer bridging page\n"); + "Unaligned spi rx-transfer bridging page\n"); return false; } Patches currently in stable-queue which might be from kernel@martin.sperl.org are queue-4.2/spi-bcm2835-bug-fix-wrong-use-of-page_mask.patch