Message ID | 20241028060140.5232-1-zhangzekun11@huawei.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | engine: ti: Fix potential NULL pointer dereference | expand |
diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c index 406ee199c2ac..fdaea8f72a9c 100644 --- a/drivers/dma/ti/k3-udma.c +++ b/drivers/dma/ti/k3-udma.c @@ -5534,6 +5534,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 */
devm_kasprintf() could failed and return a NULL pointer, which will then be used in the later code. Add check to prevent the potential NULL pointer dereference. Fixes: 25dcb5dd7b7c ("dmaengine: ti: New driver for K3 UDMA") Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com> --- drivers/dma/ti/k3-udma.c | 2 ++ 1 file changed, 2 insertions(+)