diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2013-09-02 04:14:59 -0400 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2013-09-02 08:06:00 -0400 |
commit | 2ec7e2e7b5f41a09264abc6dbcfd3fdc9a1edfd5 (patch) | |
tree | 7f11738f7ea315d345702d4a0b2817cacfdced11 | |
parent | cbbe13ea097e635ddebcc5937c5cdce16f351447 (diff) |
dma: ste_dma40: Fix potential null pointer dereference
kcalloc can return NULL. Check the pointer before dereferencing.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
-rw-r--r-- | drivers/dma/ste_dma40.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index df0a60656a8b..82d2b97ad942 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, | |||
2591 | int i; | 2591 | int i; |
2592 | 2592 | ||
2593 | sg = kcalloc(periods + 1, sizeof(struct scatterlist), GFP_NOWAIT); | 2593 | sg = kcalloc(periods + 1, sizeof(struct scatterlist), GFP_NOWAIT); |
2594 | if (!sg) | ||
2595 | return NULL; | ||
2596 | |||
2594 | for (i = 0; i < periods; i++) { | 2597 | for (i = 0; i < periods; i++) { |
2595 | sg_dma_address(&sg[i]) = dma_addr; | 2598 | sg_dma_address(&sg[i]) = dma_addr; |
2596 | sg_dma_len(&sg[i]) = period_len; | 2599 | sg_dma_len(&sg[i]) = period_len; |