From: Dan Carpenter Date: Fri, 22 Jun 2018 11:15:47 +0000 (+0300) Subject: dmaengine: k3dma: Off by one in k3_of_dma_simple_xlate() X-Git-Tag: v4.14.67~112 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bb2b7243e3f7b78b3ab720b084166d43bf0f2eac;p=platform%2Fkernel%2Flinux-exynos.git dmaengine: k3dma: Off by one in k3_of_dma_simple_xlate() [ Upstream commit c4c2b7644cc9a41f17a8cc8904efe3f66ae4c7ed ] 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 Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/dma/k3dma.c b/drivers/dma/k3dma.c index 01d2a75..219ae3b 100644 --- a/drivers/dma/k3dma.c +++ b/drivers/dma/k3dma.c @@ -787,7 +787,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));