Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1488384 > unrolled thread

[PATCH] dmaengine: k3dma: fix off by one

Started byVincent Stehlé <vincent.stehle@laposte.net>
First post2016-09-21 22:50 +0200
Last post2016-09-22 03:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] dmaengine: k3dma: fix off by one Vincent Stehlé <vincent.stehle@laposte.net> - 2016-09-21 22:50 +0200
    Re: [PATCH] dmaengine: k3dma: fix off by one zhangfei <zhangfei.gao@linaro.org> - 2016-09-22 03:40 +0200

#1488384 — [PATCH] dmaengine: k3dma: fix off by one

FromVincent Stehlé <vincent.stehle@laposte.net>
Date2016-09-21 22:50 +0200
Subject[PATCH] dmaengine: k3dma: fix off by one
Message-ID<sjWCR-5j1-1@gated-at.bofh.it>
In k3_of_dma_simple_xlate(), the d->chans[] array has d->dma_requests
elements so > should be >=.

Fixes: 8e6152bc660e69f5 ("dmaengine: Add hisilicon k3 DMA engine driver")
Signed-off-by: Vincent Stehlé <vincent.stehle@laposte.net>
Cc: Zhangfei Gao <zhangfei.gao@linaro.org>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: stable@vger.kernel.org
---
 drivers/dma/k3dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/k3dma.c b/drivers/dma/k3dma.c
index aabcb79..cd7f67b 100644
--- a/drivers/dma/k3dma.c
+++ b/drivers/dma/k3dma.c
@@ -792,7 +792,7 @@ static struct dma_chan *k3_of_dma_simple_xlate(struct of_phandle_args *dma_spec,
 	struct k3_dma_dev *d = ofdma->of_dma_data;
 	unsigned int request = dma_spec->args[0];
 
-	if (request > d->dma_requests)
+	if (request >= d->dma_requests)
 		return NULL;
 
 	return dma_get_slave_channel(&(d->chans[request].vc.chan));
-- 
2.9.3

[toc] | [next] | [standalone]


#1488501

Fromzhangfei <zhangfei.gao@linaro.org>
Date2016-09-22 03:40 +0200
Message-ID<sk19v-8co-9@gated-at.bofh.it>
In reply to#1488384

On 2016年09月22日 04:16, Vincent Stehlé wrote:
> In k3_of_dma_simple_xlate(), the d->chans[] array has d->dma_requests
> elements so > should be >=.
>
> Fixes: 8e6152bc660e69f5 ("dmaengine: Add hisilicon k3 DMA engine driver")
> Signed-off-by: Vincent Stehlé <vincent.stehle@laposte.net>
> Cc: Zhangfei Gao <zhangfei.gao@linaro.org>
> Cc: Vinod Koul <vinod.koul@intel.com>
> Cc: stable@vger.kernel.org
Acked-by: Zhangfei Gao <zhangfei.gao@linaro.org>

Thanks

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web