[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170917142510.3111-1-stefan.bruens@rwth-aachen.de>
Date: Sun, 17 Sep 2017 16:25:10 +0200
From: Stefan Brüns <stefan.bruens@...h-aachen.de>
To: <dmaengine@...r.kernel.org>
CC: Vinod Koul <vinod.koul@...el.com>, <linux-kernel@...r.kernel.org>,
"Dan Williams" <dan.j.williams@...el.com>
Subject: [PATCH] dmaengine: edma: Reject slave configs using a buswidth of 8 and larger
The driver would happily accept buswidth of 16/32/64 bytes and program
garbage to its registers.
Signed-off-by: Stefan Brüns <stefan.bruens@...h-aachen.de>
---
drivers/dma/edma.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
index 3879f80a4815..c944ea339425 100644
--- a/drivers/dma/edma.c
+++ b/drivers/dma/edma.c
@@ -887,8 +887,8 @@ static int edma_slave_config(struct dma_chan *chan,
{
struct edma_chan *echan = to_edma_chan(chan);
- if (cfg->src_addr_width == DMA_SLAVE_BUSWIDTH_8_BYTES ||
- cfg->dst_addr_width == DMA_SLAVE_BUSWIDTH_8_BYTES)
+ if (cfg->src_addr_width >= DMA_SLAVE_BUSWIDTH_8_BYTES ||
+ cfg->dst_addr_width >= DMA_SLAVE_BUSWIDTH_8_BYTES)
return -EINVAL;
memcpy(&echan->cfg, cfg, sizeof(echan->cfg));
--
2.14.1
Powered by blists - more mailing lists