lkml.org 
[lkml]   [2023]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 1/2] dmaengine: ti: add null check of devm_kasprintf in udma_probe
Date
From: Kang Chen <void0red@gmail.com>

devm_kasprintf may fails, uc->name might be null and wrong irq
name will be used in request.

Fixes: 25dcb5dd7b7c ("dmaengine: ti: New driver for K3 UDMA")
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Reviewed-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Kang Chen <void0red@gmail.com>
---
v2 -> v1: split into two patches and add some tags

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 7e23a6fdef95..692d1d25c70a 100644
--- a/drivers/dma/ti/k3-udma.c
+++ b/drivers/dma/ti/k3-udma.c
@@ -5494,6 +5494,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.34.1
\
 
 \ /
  Last update: 2023-03-27 01:06    [W:0.385 / U:0.512 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site