Messages in this thread Patch in this message | | | From | Jiasheng Jiang <> | Subject | [PATCH] dmaengine: fsl-edma: Add check for dma_pool_create | Date | Thu, 23 Mar 2023 17:19:18 +0800 |
| |
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
| |