* [PATCH] dma: ti: fix a missing check in omap_dma_prep_dma_cyclic
@ 2019-03-23 22:39 Kangjie Lu
2019-03-29 13:21 ` Peter Ujfalusi
0 siblings, 1 reply; 2+ messages in thread
From: Kangjie Lu @ 2019-03-23 22:39 UTC (permalink / raw)
To: kjlu
Cc: pakki001, Vinod Koul, Dan Williams, Peter Ujfalusi,
Janusz Krzysztofik, dmaengine, linux-kernel
It is invalid when "buf_len" is not aligned with "period_len".
The fix adds a check for the alignment.
Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
drivers/dma/ti/omap-dma.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/dma/ti/omap-dma.c b/drivers/dma/ti/omap-dma.c
index a4a931ddf6f6..5f0ce1975e52 100644
--- a/drivers/dma/ti/omap-dma.c
+++ b/drivers/dma/ti/omap-dma.c
@@ -1065,6 +1065,9 @@ static struct dma_async_tx_descriptor *omap_dma_prep_dma_cyclic(
unsigned es;
u32 burst;
+ if (buf_len % period_len)
+ return NULL;
+
if (dir == DMA_DEV_TO_MEM) {
dev_addr = c->cfg.src_addr;
dev_width = c->cfg.src_addr_width;
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] dma: ti: fix a missing check in omap_dma_prep_dma_cyclic
2019-03-23 22:39 [PATCH] dma: ti: fix a missing check in omap_dma_prep_dma_cyclic Kangjie Lu
@ 2019-03-29 13:21 ` Peter Ujfalusi
0 siblings, 0 replies; 2+ messages in thread
From: Peter Ujfalusi @ 2019-03-29 13:21 UTC (permalink / raw)
To: Kangjie Lu
Cc: pakki001, Vinod Koul, Dan Williams, Janusz Krzysztofik,
dmaengine, linux-kernel
On 24/03/2019 0.39, Kangjie Lu wrote:
> It is invalid when "buf_len" is not aligned with "period_len".
>
> The fix adds a check for the alignment.
>
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
> ---
> drivers/dma/ti/omap-dma.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/dma/ti/omap-dma.c b/drivers/dma/ti/omap-dma.c
> index a4a931ddf6f6..5f0ce1975e52 100644
> --- a/drivers/dma/ti/omap-dma.c
> +++ b/drivers/dma/ti/omap-dma.c
> @@ -1065,6 +1065,9 @@ static struct dma_async_tx_descriptor *omap_dma_prep_dma_cyclic(
> unsigned es;
> u32 burst;
>
> + if (buf_len % period_len)
> + return NULL;
> +
if it really happens, then it might be better to do the check in
dmaengine_prep_dma_cyclic() rather than fixing _all_ drivers?
> if (dir == DMA_DEV_TO_MEM) {
> dev_addr = c->cfg.src_addr;
> dev_width = c->cfg.src_addr_width;
>
- Péter
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-03-29 13:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-23 22:39 [PATCH] dma: ti: fix a missing check in omap_dma_prep_dma_cyclic Kangjie Lu
2019-03-29 13:21 ` Peter Ujfalusi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).