diff mbox

dmaengine: sirf: off by one in of_dma_sirfsoc_xlate()

Message ID 20140403072933.GD14286@mwanda (mailing list archive)
State Accepted
Delegated to: Vinod Koul
Headers show

Commit Message

Dan Carpenter April 3, 2014, 7:29 a.m. UTC
The ">" here should be ">=" or we are one step beyond the end of the
sdma->channels[] array.

Fixes: 2e041c94628c ('dmaengine: sirf: enable generic dt binding for dma channels')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Barry Song April 4, 2014, 4:52 a.m. UTC | #1
2014-04-03 15:29 GMT+08:00 Dan Carpenter <dan.carpenter@oracle.com>:
> The ">" here should be ">=" or we are one step beyond the end of the
> sdma->channels[] array.
>
> Fixes: 2e041c94628c ('dmaengine: sirf: enable generic dt binding for dma channels')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>

Acked-by: Barry Song <Baohua.Song@csr.com>

> diff --git a/drivers/dma/sirf-dma.c b/drivers/dma/sirf-dma.c
> index a1bd829..03f7820 100644
> --- a/drivers/dma/sirf-dma.c
> +++ b/drivers/dma/sirf-dma.c
> @@ -666,7 +666,7 @@ static struct dma_chan *of_dma_sirfsoc_xlate(struct of_phandle_args *dma_spec,
>         struct sirfsoc_dma *sdma = ofdma->of_dma_data;
>         unsigned int request = dma_spec->args[0];
>
> -       if (request > SIRFSOC_DMA_CHANNELS)
> +       if (request >= SIRFSOC_DMA_CHANNELS)
>                 return NULL;
>
>         return dma_get_slave_channel(&sdma->channels[request].chan);
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Vinod Koul April 16, 2014, 6:30 a.m. UTC | #2
On Thu, Apr 03, 2014 at 10:29:33AM +0300, Dan Carpenter wrote:
> The ">" here should be ">=" or we are one step beyond the end of the
> sdma->channels[] array.
> 
> Fixes: 2e041c94628c ('dmaengine: sirf: enable generic dt binding for dma channels')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied, thanks
diff mbox

Patch

diff --git a/drivers/dma/sirf-dma.c b/drivers/dma/sirf-dma.c
index a1bd829..03f7820 100644
--- a/drivers/dma/sirf-dma.c
+++ b/drivers/dma/sirf-dma.c
@@ -666,7 +666,7 @@  static struct dma_chan *of_dma_sirfsoc_xlate(struct of_phandle_args *dma_spec,
 	struct sirfsoc_dma *sdma = ofdma->of_dma_data;
 	unsigned int request = dma_spec->args[0];
 
-	if (request > SIRFSOC_DMA_CHANNELS)
+	if (request >= SIRFSOC_DMA_CHANNELS)
 		return NULL;
 
 	return dma_get_slave_channel(&sdma->channels[request].chan);