public inbox for dmaengine@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dmaengine: ti: k3-udma: Add NULL check in udma_probe
@ 2024-11-15  6:03 Charles Han
  2024-12-02 16:43 ` Vinod Koul
  0 siblings, 1 reply; 2+ messages in thread
From: Charles Han @ 2024-11-15  6:03 UTC (permalink / raw)
  To: peter.ujfalusi, vkoul; +Cc: dmaengine, Charles Han

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 --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 */
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-12-02 16:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-15  6:03 [PATCH] dmaengine: ti: k3-udma: Add NULL check in udma_probe Charles Han
2024-12-02 16:43 ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox