All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] spi_mpc8xxx: fix buffer overrun when sending only/receiving only more than PAGE_SIZE bytes
@ 2010-09-16  7:05 christophe leroy
  2010-09-16  7:40   ` Joakim Tjernlund
  2010-09-16 20:15   ` Grant Likely
  0 siblings, 2 replies; 5+ messages in thread
From: christophe leroy @ 2010-09-16  7:05 UTC (permalink / raw)
  To: David Brownell, Grant Likely, spi-devel-general, linux-kernel,
	linuxppc-dev

This patch applies to 2.6.34.7 and 2.6.35.4
It fixes an issue when sending only or receiving only more than PAGE_SIZE bytes

Signed-off-by: christophe leroy <christophe.leroy@c-s.fr>

diff -urN c/drivers/spi/spi_mpc8xxx.c d/drivers/spi/spi_mpc8xxx.c
--- c/drivers/spi/spi_mpc8xxx.c	2010-09-08 16:44:03.000000000 +0200
+++ d/drivers/spi/spi_mpc8xxx.c	2010-09-08 16:44:14.000000000 +0200
@@ -393,11 +393,17 @@
 
 	xfer_ofs = mspi->xfer_in_progress->len - mspi->count;
 
-	out_be32(&rx_bd->cbd_bufaddr, mspi->rx_dma + xfer_ofs);
+	if (mspi->rx_dma == mspi->dma_dummy_rx)
+		out_be32(&rx_bd->cbd_bufaddr, mspi->rx_dma);
+	else
+		out_be32(&rx_bd->cbd_bufaddr, mspi->rx_dma + xfer_ofs);
 	out_be16(&rx_bd->cbd_datlen, 0);
 	out_be16(&rx_bd->cbd_sc, BD_SC_EMPTY | BD_SC_INTRPT | BD_SC_WRAP);
 
-	out_be32(&tx_bd->cbd_bufaddr, mspi->tx_dma + xfer_ofs);
+	if (mspi->tx_dma == mspi->dma_dummy_tx)
+		out_be32(&tx_bd->cbd_bufaddr, mspi->tx_dma);
+	else
+		out_be32(&tx_bd->cbd_bufaddr, mspi->tx_dma + xfer_ofs);
 	out_be16(&tx_bd->cbd_datlen, xfer_len);
 	out_be16(&tx_bd->cbd_sc, BD_SC_READY | BD_SC_INTRPT | BD_SC_WRAP |
 				 BD_SC_LAST);

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] spi_mpc8xxx: fix buffer overrun when sending only/receiving only more than PAGE_SIZE bytes
  2010-09-16  7:05 [PATCH] spi_mpc8xxx: fix buffer overrun when sending only/receiving only more than PAGE_SIZE bytes christophe leroy
@ 2010-09-16  7:40   ` Joakim Tjernlund
  2010-09-16 20:15   ` Grant Likely
  1 sibling, 0 replies; 5+ messages in thread
From: Joakim Tjernlund @ 2010-09-16  7:40 UTC (permalink / raw)
  To: christophe leroy
  Cc: David Brownell, Grant Likely, linux-kernel, linuxppc-dev,
	spi-devel-general

> From: christophe leroy <christophe.leroy@c-s.fr>
> To: David Brownell <dbrownell@users.sourceforge.net>, Grant Likely
> <grant.likely@secretlab.ca>, spi-devel-general@lists.sourceforge.net, linux-
> kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
> Date: 2010/09/16 09:07
> Subject: [PATCH] spi_mpc8xxx: fix buffer overrun when sending only/receiving
> only more than PAGE_SIZE bytes
> Sent by: linuxppc-dev-bounces+joakim.tjernlund=transmode.se@lists.ozlabs.org
>
> This patch applies to 2.6.34.7 and 2.6.35.4
> It fixes an issue when sending only or receiving only more than PAGE_SIZE bytes
>
> Signed-off-by: christophe leroy <christophe.leroy@c-s.fr>

Acked-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] spi_mpc8xxx: fix buffer overrun when sending only/receiving only more than PAGE_SIZE bytes
@ 2010-09-16  7:40   ` Joakim Tjernlund
  0 siblings, 0 replies; 5+ messages in thread
From: Joakim Tjernlund @ 2010-09-16  7:40 UTC (permalink / raw)
  To: christophe leroy
  Cc: spi-devel-general, David Brownell, linuxppc-dev, linux-kernel

> From: christophe leroy <christophe.leroy@c-s.fr>
> To: David Brownell <dbrownell@users.sourceforge.net>, Grant Likely
> <grant.likely@secretlab.ca>, spi-devel-general@lists.sourceforge.net, linux-
> kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
> Date: 2010/09/16 09:07
> Subject: [PATCH] spi_mpc8xxx: fix buffer overrun when sending only/receiving
> only more than PAGE_SIZE bytes
> Sent by: linuxppc-dev-bounces+joakim.tjernlund=transmode.se@lists.ozlabs.org
>
> This patch applies to 2.6.34.7 and 2.6.35.4
> It fixes an issue when sending only or receiving only more than PAGE_SIZE bytes
>
> Signed-off-by: christophe leroy <christophe.leroy@c-s.fr>

Acked-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] spi_mpc8xxx: fix buffer overrun when sending only/receiving only more than PAGE_SIZE bytes
  2010-09-16  7:05 [PATCH] spi_mpc8xxx: fix buffer overrun when sending only/receiving only more than PAGE_SIZE bytes christophe leroy
@ 2010-09-16 20:15   ` Grant Likely
  2010-09-16 20:15   ` Grant Likely
  1 sibling, 0 replies; 5+ messages in thread
From: Grant Likely @ 2010-09-16 20:15 UTC (permalink / raw)
  To: christophe leroy
  Cc: David Brownell, spi-devel-general, linux-kernel, linuxppc-dev

On Thu, Sep 16, 2010 at 09:05:25AM +0200, christophe leroy wrote:
> This patch applies to 2.6.34.7 and 2.6.35.4
> It fixes an issue when sending only or receiving only more than PAGE_SIZE bytes
> 
> Signed-off-by: christophe leroy <christophe.leroy@c-s.fr>

applied to merge-spi branch, thanks.

g.

> 
> diff -urN c/drivers/spi/spi_mpc8xxx.c d/drivers/spi/spi_mpc8xxx.c
> --- c/drivers/spi/spi_mpc8xxx.c	2010-09-08 16:44:03.000000000 +0200
> +++ d/drivers/spi/spi_mpc8xxx.c	2010-09-08 16:44:14.000000000 +0200
> @@ -393,11 +393,17 @@
>  
>  	xfer_ofs = mspi->xfer_in_progress->len - mspi->count;
>  
> -	out_be32(&rx_bd->cbd_bufaddr, mspi->rx_dma + xfer_ofs);
> +	if (mspi->rx_dma == mspi->dma_dummy_rx)
> +		out_be32(&rx_bd->cbd_bufaddr, mspi->rx_dma);
> +	else
> +		out_be32(&rx_bd->cbd_bufaddr, mspi->rx_dma + xfer_ofs);
>  	out_be16(&rx_bd->cbd_datlen, 0);
>  	out_be16(&rx_bd->cbd_sc, BD_SC_EMPTY | BD_SC_INTRPT | BD_SC_WRAP);
>  
> -	out_be32(&tx_bd->cbd_bufaddr, mspi->tx_dma + xfer_ofs);
> +	if (mspi->tx_dma == mspi->dma_dummy_tx)
> +		out_be32(&tx_bd->cbd_bufaddr, mspi->tx_dma);
> +	else
> +		out_be32(&tx_bd->cbd_bufaddr, mspi->tx_dma + xfer_ofs);
>  	out_be16(&tx_bd->cbd_datlen, xfer_len);
>  	out_be16(&tx_bd->cbd_sc, BD_SC_READY | BD_SC_INTRPT | BD_SC_WRAP |
>  				 BD_SC_LAST);

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] spi_mpc8xxx: fix buffer overrun when sending only/receiving only more than PAGE_SIZE bytes
@ 2010-09-16 20:15   ` Grant Likely
  0 siblings, 0 replies; 5+ messages in thread
From: Grant Likely @ 2010-09-16 20:15 UTC (permalink / raw)
  To: christophe leroy
  Cc: spi-devel-general, David Brownell, linuxppc-dev, linux-kernel

On Thu, Sep 16, 2010 at 09:05:25AM +0200, christophe leroy wrote:
> This patch applies to 2.6.34.7 and 2.6.35.4
> It fixes an issue when sending only or receiving only more than PAGE_SIZE bytes
> 
> Signed-off-by: christophe leroy <christophe.leroy@c-s.fr>

applied to merge-spi branch, thanks.

g.

> 
> diff -urN c/drivers/spi/spi_mpc8xxx.c d/drivers/spi/spi_mpc8xxx.c
> --- c/drivers/spi/spi_mpc8xxx.c	2010-09-08 16:44:03.000000000 +0200
> +++ d/drivers/spi/spi_mpc8xxx.c	2010-09-08 16:44:14.000000000 +0200
> @@ -393,11 +393,17 @@
>  
>  	xfer_ofs = mspi->xfer_in_progress->len - mspi->count;
>  
> -	out_be32(&rx_bd->cbd_bufaddr, mspi->rx_dma + xfer_ofs);
> +	if (mspi->rx_dma == mspi->dma_dummy_rx)
> +		out_be32(&rx_bd->cbd_bufaddr, mspi->rx_dma);
> +	else
> +		out_be32(&rx_bd->cbd_bufaddr, mspi->rx_dma + xfer_ofs);
>  	out_be16(&rx_bd->cbd_datlen, 0);
>  	out_be16(&rx_bd->cbd_sc, BD_SC_EMPTY | BD_SC_INTRPT | BD_SC_WRAP);
>  
> -	out_be32(&tx_bd->cbd_bufaddr, mspi->tx_dma + xfer_ofs);
> +	if (mspi->tx_dma == mspi->dma_dummy_tx)
> +		out_be32(&tx_bd->cbd_bufaddr, mspi->tx_dma);
> +	else
> +		out_be32(&tx_bd->cbd_bufaddr, mspi->tx_dma + xfer_ofs);
>  	out_be16(&tx_bd->cbd_datlen, xfer_len);
>  	out_be16(&tx_bd->cbd_sc, BD_SC_READY | BD_SC_INTRPT | BD_SC_WRAP |
>  				 BD_SC_LAST);

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-09-16 20:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-16  7:05 [PATCH] spi_mpc8xxx: fix buffer overrun when sending only/receiving only more than PAGE_SIZE bytes christophe leroy
2010-09-16  7:40 ` Joakim Tjernlund
2010-09-16  7:40   ` Joakim Tjernlund
2010-09-16 20:15 ` Grant Likely
2010-09-16 20:15   ` Grant Likely

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.