Commit 61c6e753 authored by Sachin Kamat's avatar Sachin Kamat Committed by Vinod Koul

DMA: PL330: Check the pointer returned by kzalloc

kzalloc could return NULL. Hence add a check to avoid
NULL pointer dereference.
Signed-off-by: default avatarSachin Kamat <sachin.kamat@linaro.org>
Acked-by: default avatarJassi Brar <jassisinghbrar@gmail.com>
Cc: Stable <stable@vger.kernel.org>
Signed-off-by: default avatarVinod Koul <vinod.koul@linux.intel.com>
parent 2e2c682b
...@@ -2930,6 +2930,11 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) ...@@ -2930,6 +2930,11 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
num_chan = max_t(int, pi->pcfg.num_peri, pi->pcfg.num_chan); num_chan = max_t(int, pi->pcfg.num_peri, pi->pcfg.num_chan);
pdmac->peripherals = kzalloc(num_chan * sizeof(*pch), GFP_KERNEL); pdmac->peripherals = kzalloc(num_chan * sizeof(*pch), GFP_KERNEL);
if (!pdmac->peripherals) {
ret = -ENOMEM;
dev_err(&adev->dev, "unable to allocate pdmac->peripherals\n");
goto probe_err5;
}
for (i = 0; i < num_chan; i++) { for (i = 0; i < num_chan; i++) {
pch = &pdmac->peripherals[i]; pch = &pdmac->peripherals[i];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment