* [PATCH 1/2] dmaengine: at_hdmac: fix comment in atc_prep_slave_sg()
@ 2012-09-11 15:21 Nicolas Ferre
2012-09-11 15:21 ` [PATCH 2/2] dmaengine: at_hdmac: check that each sg data length is non-null Nicolas Ferre
2012-09-14 2:57 ` [PATCH 1/2] dmaengine: at_hdmac: fix comment in atc_prep_slave_sg() Vinod Koul
0 siblings, 2 replies; 3+ messages in thread
From: Nicolas Ferre @ 2012-09-11 15:21 UTC (permalink / raw)
To: vinod.koul
Cc: linux-arm-kernel, plagnioj, linux-kernel, ludovic.desroches,
nicolas.ferre
s/dma_memcpy/slave_sg/ and it is sg length that we are
talking about.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Stable <stable@vger.kernel.org> [2.6.31+]
---
drivers/dma/at_hdmac.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index 3934fcc..6c09e18 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -661,7 +661,7 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
flags);
if (unlikely(!atslave || !sg_len)) {
- dev_dbg(chan2dev(chan), "prep_dma_memcpy: length is zero!\n");
+ dev_dbg(chan2dev(chan), "prep_slave_sg: sg length is zero!\n");
return NULL;
}
--
1.7.10
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] dmaengine: at_hdmac: check that each sg data length is non-null
2012-09-11 15:21 [PATCH 1/2] dmaengine: at_hdmac: fix comment in atc_prep_slave_sg() Nicolas Ferre
@ 2012-09-11 15:21 ` Nicolas Ferre
2012-09-14 2:57 ` [PATCH 1/2] dmaengine: at_hdmac: fix comment in atc_prep_slave_sg() Vinod Koul
1 sibling, 0 replies; 3+ messages in thread
From: Nicolas Ferre @ 2012-09-11 15:21 UTC (permalink / raw)
To: vinod.koul
Cc: linux-arm-kernel, plagnioj, linux-kernel, ludovic.desroches,
nicolas.ferre
Avoid the construction of a malformed DMA request sent to
the DMA controller.
Log message is for debug only because this condition is unlikely to
append and may only trigger at driver development time.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Stable <stable@vger.kernel.org> [2.6.31+]
---
drivers/dma/at_hdmac.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index 6c09e18..7ab6e26 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -689,6 +689,11 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
mem = sg_dma_address(sg);
len = sg_dma_len(sg);
+ if (unlikely(!len)) {
+ dev_dbg(chan2dev(chan),
+ "prep_slave_sg: sg(%d) data length is zero\n", i);
+ goto err;
+ }
mem_width = 2;
if (unlikely(mem & 3 || len & 3))
mem_width = 0;
@@ -724,6 +729,11 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
mem = sg_dma_address(sg);
len = sg_dma_len(sg);
+ if (unlikely(!len)) {
+ dev_dbg(chan2dev(chan),
+ "prep_slave_sg: sg(%d) data length is zero\n", i);
+ goto err;
+ }
mem_width = 2;
if (unlikely(mem & 3 || len & 3))
mem_width = 0;
@@ -757,6 +767,7 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
err_desc_get:
dev_err(chan2dev(chan), "not enough descriptors available\n");
+err:
atc_desc_put(atchan, first);
return NULL;
}
--
1.7.10
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] dmaengine: at_hdmac: fix comment in atc_prep_slave_sg()
2012-09-11 15:21 [PATCH 1/2] dmaengine: at_hdmac: fix comment in atc_prep_slave_sg() Nicolas Ferre
2012-09-11 15:21 ` [PATCH 2/2] dmaengine: at_hdmac: check that each sg data length is non-null Nicolas Ferre
@ 2012-09-14 2:57 ` Vinod Koul
1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2012-09-14 2:57 UTC (permalink / raw)
To: Nicolas Ferre; +Cc: linux-arm-kernel, plagnioj, linux-kernel, ludovic.desroches
On Tue, 2012-09-11 at 17:21 +0200, Nicolas Ferre wrote:
> s/dma_memcpy/slave_sg/ and it is sg length that we are
> talking about.
>
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> Cc: Stable <stable@vger.kernel.org> [2.6.31+]
> ---
> drivers/dma/at_hdmac.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> index 3934fcc..6c09e18 100644
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c
> @@ -661,7 +661,7 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
> flags);
>
> if (unlikely(!atslave || !sg_len)) {
> - dev_dbg(chan2dev(chan), "prep_dma_memcpy: length is zero!\n");
> + dev_dbg(chan2dev(chan), "prep_slave_sg: sg length is zero!\n");
> return NULL;
> }
Applied both, Thanks.
I will send this to Linus in couple of days
--
~Vinod
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-09-14 3:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-11 15:21 [PATCH 1/2] dmaengine: at_hdmac: fix comment in atc_prep_slave_sg() Nicolas Ferre
2012-09-11 15:21 ` [PATCH 2/2] dmaengine: at_hdmac: check that each sg data length is non-null Nicolas Ferre
2012-09-14 2:57 ` [PATCH 1/2] dmaengine: at_hdmac: fix comment in atc_prep_slave_sg() Vinod Koul
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).