public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: void0red <void0red@gmail.com>
To: vkoul@kernel.org
Cc: dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org,
	peter.ujfalusi@gmail.com, void0red@gmail.com
Subject: [PATCH v2 2/2] dmaengine: ti: add null check of devm_kasprintf in edma_probe
Date: Sat, 18 Mar 2023 14:22:55 +0800	[thread overview]
Message-ID: <20230318062255.76-2-void0red@gmail.com> (raw)
In-Reply-To: <20230318062255.76-1-void0red@gmail.com>

From: Kang Chen <void0red@gmail.com>

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

Fixes: 2b6b3b742019 ("ARM/dmaengine: edma: Merge the two drivers under drivers/dma/")
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/edma.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/dma/ti/edma.c b/drivers/dma/ti/edma.c
index fa06d7e6d8e3..85cd72b6401a 100644
--- a/drivers/dma/ti/edma.c
+++ b/drivers/dma/ti/edma.c
@@ -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) {
-- 
2.34.1


      reply	other threads:[~2023-03-18  6:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-26  9:40 [PATCH] dmaengine: ti: add null check of devm_kasprintf in edma_probe and udma_probe Kang Chen
2023-03-14 20:01 ` Péter Ujfalusi
2023-03-17 17:31   ` Vinod Koul
2023-03-18  6:22     ` [PATCH v2 1/2] dmaengine: ti: add null check of devm_kasprintf in udma_probe void0red
2023-03-18  6:22       ` void0red [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230318062255.76-2-void0red@gmail.com \
    --to=void0red@gmail.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peter.ujfalusi@gmail.com \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox