* [PATCH] dmaengine: fsl-edma: Add check for dma_pool_create
@ 2023-03-23 9:19 Jiasheng Jiang
0 siblings, 0 replies; only message in thread
From: Jiasheng Jiang @ 2023-03-23 9:19 UTC (permalink / raw)
To: vkoul; +Cc: dmaengine, linux-kernel, Jiasheng Jiang
Add the check for the return value of the dma_pool_create and return the
error if it fails, in order to avoid NULL pointer dereference in the
fsl_edma_alloc_desc.
Fixes: d6be34fbd39b ("dma: Add Freescale eDMA engine driver support")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
drivers/dma/fsl-edma-common.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c
index a06a1575a2a5..a24095c941b6 100644
--- a/drivers/dma/fsl-edma-common.c
+++ b/drivers/dma/fsl-edma-common.c
@@ -658,6 +658,9 @@ int fsl_edma_alloc_chan_resources(struct dma_chan *chan)
fsl_chan->tcd_pool = dma_pool_create("tcd_pool", chan->device->dev,
sizeof(struct fsl_edma_hw_tcd),
32, 0);
+ if (!fsl_chan->tcd_pool)
+ return -ENOMEM;
+
return 0;
}
EXPORT_SYMBOL_GPL(fsl_edma_alloc_chan_resources);
--
2.25.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-03-23 9:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-23 9:19 [PATCH] dmaengine: fsl-edma: Add check for dma_pool_create Jiasheng Jiang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).