dmaengine: ti: add null check of devm_kasprintf in edma_probe and udma_probe
Subsystems (2)
PATCH 1/1 dmaengine: ti: add null check of devm_kasprintf in edma_probe and udma_probe
devm_kasprintf may fails, irq_name and uc->name might be null and wrong irq name will be used in request.
--- drivers/dma/ti/edma.c | 8 ++++++++ drivers/dma/ti/k3-udma.c | 2 ++ 2 files changed, 10 insertions(+)
drivers/dma/ti/edma.c +8 -0
@@ -2413,6 +2413,10 @@ static int edma_probe(struct platform_device *pdev)if (irq >=0 ) { irq_name =devm_kasprintf (dev,GFP_KERNEL ,"%s_ccint" ,dev_name (dev)); +if (!irq_name) { + ret = -ENOMEM ; + goto err_disable_pm; + } ret =devm_request_irq (dev, irq, dma_irq_handler,0 , irq_name, ecc);if (ret) {
@@ -2429,6 +2433,10 @@ static int edma_probe(struct platform_device *pdev)if (irq >=0 ) { irq_name =devm_kasprintf (dev,GFP_KERNEL ,"%s_ccerrint" ,dev_name (dev)); +if (!irq_name) { + ret = -ENOMEM ; + goto err_disable_pm; + } ret =devm_request_irq (dev, irq, dma_ccerr_handler,0 , irq_name, ecc);if (ret) {
drivers/dma/ti/k3-udma.c +2 -0
@@ -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 */
Signature · 1 line
2.34.1
Hi,
Quoted 2 lines · Kang Chen
devm_kasprintfmay fails,irq_nameanduc->namemight be null and wrong irq name will be used in request.
In general, I would have preferred to have separate patches for the two drivers to make them easier to backport if one decides.
If you decide to resend, you can add my to them:
Quoted 46 lines
Signed-off-by Kang Chen <[email protected]>--- drivers/dma/ti/edma.c | 8 ++++++++ drivers/dma/ti/k3-udma.c | 2 ++ 2 files changed, 10 insertions(+)drivers/dma/ti/edma.c +8
-0@@ -2413,6 +2413,10 @@ static int edma_probe(struct platform_device *pdev)if (irq >=0 ) { irq_name =devm_kasprintf (dev,GFP_KERNEL ,"%s_ccint" ,dev_name (dev)); +if (!irq_name) { + ret = -ENOMEM ; + goto err_disable_pm; + } ret =devm_request_irq (dev, irq, dma_irq_handler,0 , irq_name, ecc);if (ret) {@@ -2429,6 +2433,10 @@ static int edma_probe(struct platform_device *pdev)if (irq >=0 ) { irq_name =devm_kasprintf (dev,GFP_KERNEL ,"%s_ccerrint" ,dev_name (dev)); +if (!irq_name) { + ret = -ENOMEM ; + goto err_disable_pm; + } ret =devm_request_irq (dev, irq, dma_ccerr_handler,0 , irq_name, ecc);if (ret) {drivers/dma/ti/k3-udma.c +2
-0@@ -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 */
Signature · 1 line
Péter
Vinod Koul
maintainerQuoted 8 lines · Péter Ujfalusi
Hi,
Quoted 2 lines · Kang Chen
devm_kasprintfmay fails,irq_nameanduc->namemight be null and wrong irq name will be used in request.In general, I would have preferred to have separate patches for the two drivers to make them easier to backport if one decides.
Right these should be separate
Quoted 53 lines
If you decide to resend, you can add my to them:
Acked-by Peter Ujfalusi <[email protected]>Quoted 45 lines
Signed-off-by Kang Chen <[email protected]>--- drivers/dma/ti/edma.c | 8 ++++++++ drivers/dma/ti/k3-udma.c | 2 ++ 2 files changed, 10 insertions(+)drivers/dma/ti/edma.c +8
-0@@ -2413,6 +2413,10 @@ static int edma_probe(struct platform_device *pdev)if (irq >=0 ) { irq_name =devm_kasprintf (dev,GFP_KERNEL ,"%s_ccint" ,dev_name (dev)); +if (!irq_name) { + ret = -ENOMEM ; + goto err_disable_pm; + } ret =devm_request_irq (dev, irq, dma_irq_handler,0 , irq_name, ecc);if (ret) {@@ -2429,6 +2433,10 @@ static int edma_probe(struct platform_device *pdev)if (irq >=0 ) { irq_name =devm_kasprintf (dev,GFP_KERNEL ,"%s_ccerrint" ,dev_name (dev)); +if (!irq_name) { + ret = -ENOMEM ; + goto err_disable_pm; + } ret =devm_request_irq (dev, irq, dma_ccerr_handler,0 , irq_name, ecc);if (ret) {drivers/dma/ti/k3-udma.c +2
-0@@ -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 */ Signature · 1 line
Péter
Signature · 1 line
~Vinod
PATCH v2 1/2 dmaengine: ti: add null check of devm_kasprintf in udma_probe
From: Kang Chen <[email protected]>
devm_kasprintf may fails, uc->name might be null and wrong irq name will be used in request.
---
v2 -> v1: split into two patches and add some tags
drivers/dma/ti/k3-udma.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/dma/ti/k3-udma.c +2 -0
@@ -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 */
Signature · 1 line
2.34.1
PATCH v2 2/2 dmaengine: ti: add null check of devm_kasprintf in edma_probe
From: Kang Chen <[email protected]>
devm_kasprintf may fails, irq_name might be null and wrong irq name will be used in request.
---
v2 -> v1: split into two patches and add some tags
drivers/dma/ti/edma.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/dma/ti/edma.c +8 -0
@@ -2413,6 +2413,10 @@ static int edma_probe(struct platform_device *pdev)if (irq >=0 ) { irq_name =devm_kasprintf (dev,GFP_KERNEL ,"%s_ccint" ,dev_name (dev)); +if (!irq_name) { + ret = -ENOMEM ; + goto err_disable_pm; + } ret =devm_request_irq (dev, irq, dma_irq_handler,0 , irq_name, ecc);if (ret) {
@@ -2429,6 +2433,10 @@ static int edma_probe(struct platform_device *pdev)if (irq >=0 ) { irq_name =devm_kasprintf (dev,GFP_KERNEL ,"%s_ccerrint" ,dev_name (dev)); +if (!irq_name) { + ret = -ENOMEM ; + goto err_disable_pm; + } ret =devm_request_irq (dev, irq, dma_ccerr_handler,0 , irq_name, ecc);if (ret) {
Signature · 1 line
2.34.1