diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2013-09-02 08:14:59 (GMT) |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2013-09-02 12:06:00 (GMT) |
commit | 2ec7e2e7b5f41a09264abc6dbcfd3fdc9a1edfd5 (patch) | |
tree | 7f11738f7ea315d345702d4a0b2817cacfdced11 /drivers/dma | |
parent | cbbe13ea097e635ddebcc5937c5cdce16f351447 (diff) | |
download | linux-2ec7e2e7b5f41a09264abc6dbcfd3fdc9a1edfd5.tar.xz |
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/dma')
-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 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; |