public inbox for dmaengine@vger.kernel.org
 help / color / mirror / Atom feed
From: Vinod Koul <vkoul@kernel.org>
To: Charles Han <hanchunchao@inspur.com>
Cc: peter.ujfalusi@gmail.com, dmaengine@vger.kernel.org
Subject: Re: [PATCH] dmaengine: ti: k3-udma: Add NULL check in udma_probe
Date: Mon, 2 Dec 2024 22:13:01 +0530	[thread overview]
Message-ID: <Z03jlQBuYt9iOLj+@vaman> (raw)
In-Reply-To: <20241115060336.3610-1-hanchunchao@inspur.com>

On 15-11-24, 14:03, Charles Han wrote:
> devm_kasprintf() can return a NULL pointer on failure,but this
> returned value udma_probe() is not checked.
> Add NULL check in udma_probe(), to handle kernel NULL
> pointer dereference error.
> 
> Fixes: 25dcb5dd7b7c ("dmaengine: ti: New driver for K3 UDMA")
> Signed-off-by: Charles Han <hanchunchao@inspur.com>
> ---
>  drivers/dma/ti/k3-udma.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
> index b3f27b3f9209..e940753a8ab1 100644
> --- a/drivers/dma/ti/k3-udma.c
> +++ b/drivers/dma/ti/k3-udma.c
> @@ -5566,6 +5566,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;

what is the condition when this can occur?

>  
>  		vchan_init(&uc->vc, &ud->ddev);
>  		/* Use custom vchan completion handling */
> -- 
> 2.31.1

-- 
~Vinod

      reply	other threads:[~2024-12-02 16:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-15  6:03 [PATCH] dmaengine: ti: k3-udma: Add NULL check in udma_probe Charles Han
2024-12-02 16:43 ` Vinod Koul [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=Z03jlQBuYt9iOLj+@vaman \
    --to=vkoul@kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=hanchunchao@inspur.com \
    --cc=peter.ujfalusi@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