Skip to content

Commit

Permalink
dmaengine: k3dma: Off by one in k3_of_dma_simple_xlate()
Browse files Browse the repository at this point in the history
The d->chans[] array has d->dma_requests elements so the > should be
>= here.

Fixes: 8e6152b ("dmaengine: Add hisilicon k3 DMA engine driver")
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Vinod Koul <[email protected]>
  • Loading branch information
Dan Carpenter authored and vinodkoul committed Jun 28, 2018
1 parent e3f329c commit c4c2b76
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/dma/k3dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,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));
Expand Down

0 comments on commit c4c2b76

Please sign in to comment.