[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2024101339-femur-juniper-3b77@gregkh>
Date: Sun, 13 Oct 2024 17:16:08 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: Charles Han <hanchunchao@...pur.com>
Cc: alexandru.ardelean@...log.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] uio: uio_fsl_elbc_gpcm: Add check devm_kasprintf()
returned value
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@...pur.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 :(
Powered by blists - more mailing lists