Skip to content

Commit 6e22762

Browse files
KunWuChanvinodkoul
authored andcommitted
dmaengine: ti: edma: Add some null pointer checks to the edma_probe
devm_kasprintf() returns a pointer to dynamically allocated memory which can be NULL upon failure. Ensure the allocation was successful by checking the pointer validity. Signed-off-by: Kunwu Chan <chentao@kylinos.cn> Link: https://lore.kernel.org/r/20240118031929.192192-1-chentao@kylinos.cn Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent b73e43d commit 6e22762

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

drivers/dma/ti/edma.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2404,6 +2404,11 @@ static int edma_probe(struct platform_device *pdev)
24042404
if (irq > 0) {
24052405
irq_name = devm_kasprintf(dev, GFP_KERNEL, "%s_ccint",
24062406
dev_name(dev));
2407+
if (!irq_name) {
2408+
ret = -ENOMEM;
2409+
goto err_disable_pm;
2410+
}
2411+
24072412
ret = devm_request_irq(dev, irq, dma_irq_handler, 0, irq_name,
24082413
ecc);
24092414
if (ret) {
@@ -2420,6 +2425,11 @@ static int edma_probe(struct platform_device *pdev)
24202425
if (irq > 0) {
24212426
irq_name = devm_kasprintf(dev, GFP_KERNEL, "%s_ccerrint",
24222427
dev_name(dev));
2428+
if (!irq_name) {
2429+
ret = -ENOMEM;
2430+
goto err_disable_pm;
2431+
}
2432+
24232433
ret = devm_request_irq(dev, irq, dma_ccerr_handler, 0, irq_name,
24242434
ecc);
24252435
if (ret) {

0 commit comments

Comments
 (0)