[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0b99b7e5-a035-4a15-8389-dcb3ca81f96d@kernel.org>
Date: Mon, 31 Mar 2025 13:39:21 +0200
From: Krzysztof Kozlowski <krzk@...nel.org>
To: Henry Martin <bsdhenrymartin@...il.com>, gregkh@...uxfoundation.org
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH] uio: uio_fsl_elbc_gpcm: Add NULL check in the
uio_fsl_elbc_gpcm_probe
On 31/03/2025 11:27, Henry Martin wrote:
> When devm_kasprintf() fails, it returns a NULL pointer. However, this return value is not properly checked in the function uio_fsl_elbc_gpcm_probe.
>
> A NULL check should be added after the devm_kasprintf() to prevent potential NULL pointer dereference error.
>
> Fixes: d57801c45f53e ("uio: uio_fsl_elbc_gpcm: use device-managed allocators")
>
Same comments as for other patches.
> Signed-off-by: Henry Martin <bsdhenrymartin@...il.com>
> ---
> drivers/uio/uio_fsl_elbc_gpcm.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/uio/uio_fsl_elbc_gpcm.c b/drivers/uio/uio_fsl_elbc_gpcm.c
> index 81454c3e2484..59ba1a2dcfe3 100644
> --- a/drivers/uio/uio_fsl_elbc_gpcm.c
> +++ b/drivers/uio/uio_fsl_elbc_gpcm.c
> @@ -384,6 +384,10 @@ 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) {
> + dev_err(priv->dev, "devm_kasprintf failed for region name\n");
There is never a printk after memory allocation failure.
Also, just like in some of the other patches, you did not really analyze
the code - you leak here resource map. Just look at the entire code
instead of blindly pasting the same code here and there.
Best regards,
Krzysztof
Powered by blists - more mailing lists