aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2018-06-22 07:15:47 -0400
committerVinod Koul <vkoul@kernel.org>2018-06-28 02:27:21 -0400
commitc4c2b7644cc9a41f17a8cc8904efe3f66ae4c7ed (patch)
tree103309362c2d2f97721eef7c763cc5d9dfd52072
parente3f329c600033f011a978a8bc4ddb1e2e94c4f4d (diff)
dmaengine: k3dma: Off by one in k3_of_dma_simple_xlate()
The d->chans[] array has d->dma_requests elements so the > should be >= here. Fixes: 8e6152bc660e ("dmaengine: Add hisilicon k3 DMA engine driver") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Vinod Koul <vkoul@kernel.org>
-rw-r--r--drivers/dma/k3dma.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/dma/k3dma.c b/drivers/dma/k3dma.c
index fa31cccbe04f..6bfa217ed6d0 100644
--- a/drivers/dma/k3dma.c
+++ b/drivers/dma/k3dma.c
@@ -794,7 +794,7 @@ static struct dma_chan *k3_of_dma_simple_xlate(struct of_phandle_args *dma_spec,
794 struct k3_dma_dev *d = ofdma->of_dma_data; 794 struct k3_dma_dev *d = ofdma->of_dma_data;
795 unsigned int request = dma_spec->args[0]; 795 unsigned int request = dma_spec->args[0];
796 796
797 if (request > d->dma_requests) 797 if (request >= d->dma_requests)
798 return NULL; 798 return NULL;
799 799
800 return dma_get_slave_channel(&(d->chans[request].vc.chan)); 800 return dma_get_slave_channel(&(d->chans[request].vc.chan));