diff mbox series

dmaengine: ti: k3-udma: Add NULL check in udma_probe

Message ID 20241115060336.3610-1-hanchunchao@inspur.com (mailing list archive)
State New
Headers show
Series dmaengine: ti: k3-udma: Add NULL check in udma_probe | expand

Commit Message

Charles Han Nov. 15, 2024, 6:03 a.m. UTC
devm_kasprintf() can return a NULL pointer on failure,but this
returned value udma_probe() is not checked.
Add NULL check in udma_probe(), to handle kernel NULL
pointer dereference error.

Fixes: 25dcb5dd7b7c ("dmaengine: ti: New driver for K3 UDMA")
Signed-off-by: Charles Han <hanchunchao@inspur.com>
---
 drivers/dma/ti/k3-udma.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
index b3f27b3f9209..e940753a8ab1 100644
--- a/drivers/dma/ti/k3-udma.c
+++ b/drivers/dma/ti/k3-udma.c
@@ -5566,6 +5566,8 @@  static int udma_probe(struct platform_device *pdev)
 		uc->config.dir = DMA_MEM_TO_MEM;
 		uc->name = devm_kasprintf(dev, GFP_KERNEL, "%s chan%d",
 					  dev_name(dev), i);
+		if (!uc->name)
+			return -ENOMEM;
 
 		vchan_init(&uc->vc, &ud->ddev);
 		/* Use custom vchan completion handling */