From: "Péter Ujfalusi" <peter.ujfalusi@gmail.com>
To: Kang Chen <void0red@gmail.com>
Cc: vkoul@kernel.org, dmaengine@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dmaengine: ti: add null check of devm_kasprintf in edma_probe and udma_probe
Date: Tue, 14 Mar 2023 22:01:40 +0200 [thread overview]
Message-ID: <c0a50add-5c76-8e16-f65b-803d4389b36f@gmail.com> (raw)
In-Reply-To: <20230226094038.3227062-1-void0red@gmail.com>
Hi,
On 26/02/2023 11:40, Kang Chen wrote:
> devm_kasprintf may fails, irq_name and uc->name might 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:
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
>
> Signed-off-by: Kang Chen <void0red@gmail.com>
> ---
> drivers/dma/ti/edma.c | 8 ++++++++
> drivers/dma/ti/k3-udma.c | 2 ++
> 2 files changed, 10 insertions(+)
>
> diff --git a/drivers/dma/ti/edma.c b/drivers/dma/ti/edma.c
> index fa06d7e6d..85cd72b64 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) {
> diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
> index 7e23a6fde..692d1d25c 100644
> --- a/drivers/dma/ti/k3-udma.c
> +++ b/drivers/dma/ti/k3-udma.c
> @@ -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 */
--
Péter
next prev parent reply other threads:[~2023-03-14 19:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-26 9:40 Kang Chen
2023-03-14 20:01 ` Péter Ujfalusi [this message]
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 ` [PATCH v2 2/2] dmaengine: ti: add null check of devm_kasprintf in edma_probe void0red
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=c0a50add-5c76-8e16-f65b-803d4389b36f@gmail.com \
--to=peter.ujfalusi@gmail.com \
--cc=dmaengine@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=vkoul@kernel.org \
--cc=void0red@gmail.com \
/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
all inboxes | Powered by JetHome®