summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorSachin Kamat <sachin.kamat@linaro.org>2013-09-02 13:44:59 +0530
committerVinod Koul <vinod.koul@intel.com>2013-09-02 17:36:00 +0530
commit2ec7e2e7b5f41a09264abc6dbcfd3fdc9a1edfd5 (patch)
tree7f11738f7ea315d345702d4a0b2817cacfdced11 /drivers
parentcbbe13ea097e635ddebcc5937c5cdce16f351447 (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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/dma/ste_dma40.c3
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,
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;