mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Charles Han <hanchunchao@inspur.com>
Cc: alexandru.ardelean@analog.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] uio: uio_fsl_elbc_gpcm: Add check devm_kasprintf() returned value
Date: Sun, 13 Oct 2024 17:16:08 +0200	[thread overview]
Message-ID: <2024101339-femur-juniper-3b77@gregkh> (raw)
In-Reply-To: <20240929034223.59209-1-hanchunchao@inspur.com>

On Sun, Sep 29, 2024 at 11:42:23AM +0800, Charles Han wrote:
> devm_kasprintf() can return a NULL pointer on failure but this
> returned value in uio_fsl_elbc_gpcm_probe() is not checked.
> 
> Fixes: d57801c45f53 ("uio: uio_fsl_elbc_gpcm: use device-managed allocators")
> Signed-off-by: Charles Han <hanchunchao@inspur.com>
> ---
>  drivers/uio/uio_fsl_elbc_gpcm.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/uio/uio_fsl_elbc_gpcm.c b/drivers/uio/uio_fsl_elbc_gpcm.c
> index 496caff66e7e..6378e752f828 100644
> --- a/drivers/uio/uio_fsl_elbc_gpcm.c
> +++ b/drivers/uio/uio_fsl_elbc_gpcm.c
> @@ -384,6 +384,9 @@ static int uio_fsl_elbc_gpcm_probe(struct platform_device *pdev)
>  
>  	/* set all UIO data */
>  	info->mem[0].name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%pOFn", node);
> +	if (!info->mem[0].name)
> +		return -ENOMEM;

This is wrong, please fix your tools that created such a patch as it now
leaks memory :(


      reply	other threads:[~2024-10-13 15:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-29  3:42 Charles Han
2024-10-13 15:16 ` Greg KH [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=2024101339-femur-juniper-3b77@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=alexandru.ardelean@analog.com \
    --cc=hanchunchao@inspur.com \
    --cc=linux-kernel@vger.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

all inboxes | Powered by JetHome®