Skip to content

Commit fd44741

Browse files
Henry Martinvinodkoul
authored andcommitted
dmaengine: ti: Add NULL check in udma_probe()
devm_kasprintf() returns NULL when memory allocation fails. Currently, udma_probe() does not check for this case, which results in a NULL pointer dereference. Add NULL check after devm_kasprintf() to prevent this issue. Fixes: 25dcb5d ("dmaengine: ti: New driver for K3 UDMA") Signed-off-by: Henry Martin <[email protected]> Reviewed-by: Nathan Lynch <[email protected]> Acked-by: Peter Ujfalusi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 00ff4d6 commit fd44741

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/dma/ti/k3-udma.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5618,7 +5618,8 @@ static int udma_probe(struct platform_device *pdev)
56185618
uc->config.dir = DMA_MEM_TO_MEM;
56195619
uc->name = devm_kasprintf(dev, GFP_KERNEL, "%s chan%d",
56205620
dev_name(dev), i);
5621-
5621+
if (!uc->name)
5622+
return -ENOMEM;
56225623
vchan_init(&uc->vc, &ud->ddev);
56235624
/* Use custom vchan completion handling */
56245625
tasklet_setup(&uc->vc.task, udma_vchan_complete);

0 commit comments

Comments
 (0)