2013-09-02 08:32:46

by Sachin Kamat

[permalink] [raw]
Subject: [PATCH 1/2] dma: ste_dma40: Remove duplicate const

'const' was added twice.

Signed-off-by: Sachin Kamat <[email protected]>
---
drivers/dma/ste_dma40.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index 7bbcabb..df0a606 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -3485,7 +3485,7 @@ static int __init d40_of_probe(struct platform_device *pdev,
{
struct stedma40_platform_data *pdata;
int num_phy = 0, num_memcpy = 0, num_disabled = 0;
- const const __be32 *list;
+ const __be32 *list;

pdata = devm_kzalloc(&pdev->dev,
sizeof(struct stedma40_platform_data),
--
1.7.9.5


2013-09-02 08:32:50

by Sachin Kamat

[permalink] [raw]
Subject: [PATCH 2/2] dma: ste_dma40: Fix potential null pointer dereference

kcalloc can return NULL. Check the pointer before dereferencing.

Signed-off-by: Sachin Kamat <[email protected]>
---
drivers/dma/ste_dma40.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index df0a606..82d2b97 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -2591,6 +2591,9 @@ dma40_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t dma_addr,
int i;

sg = kcalloc(periods + 1, sizeof(struct scatterlist), GFP_NOWAIT);
+ if (!sg)
+ return NULL;
+
for (i = 0; i < periods; i++) {
sg_dma_address(&sg[i]) = dma_addr;
sg_dma_len(&sg[i]) = period_len;
--
1.7.9.5

2013-09-02 11:33:00

by Vinod Koul

[permalink] [raw]
Subject: Re: [PATCH 1/2] dma: ste_dma40: Remove duplicate const

On Mon, Sep 02, 2013 at 01:44:58PM +0530, Sachin Kamat wrote:
> 'const' was added twice.
>
Applied, both thanks

~Vinod

2013-09-12 09:34:36

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 2/2] dma: ste_dma40: Fix potential null pointer dereference

On Mon, Sep 2, 2013 at 10:14 AM, Sachin Kamat <[email protected]> wrote:

> kcalloc can return NULL. Check the pointer before dereferencing.
>
> Signed-off-by: Sachin Kamat <[email protected]>

Acked-by: Linus Walleij <[email protected]>

I guess Vinod can take this into fixes for v3.12?

Yours,
Linus Walleij