lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z+v9qbFjSNpDcHW1@lizhi-Precision-Tower-5810>
Date: Tue, 1 Apr 2025 10:52:25 -0400
From: Frank Li <Frank.li@....com>
To: Henry Martin <bsdhenrymartin@...il.com>
Cc: shengjiu.wang@...il.com, xiubo.lee@...il.com, festevam@...il.com,
	nicoleotsuka@...il.com, lgirdwood@...il.com, broonie@...nel.org,
	perex@...ex.cz, tiwai@...e.com, shawnguo@...nel.org,
	s.hauer@...gutronix.de, kernel@...gutronix.de,
	linux-sound@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
	imx@...ts.linux.dev, linux-arm-kernel@...ts.infradead.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1] ASoC: imx-card: Add NULL check in imx_card_probe()

On Tue, Apr 01, 2025 at 10:25:10PM +0800, Henry Martin wrote:
> devm_kasprintf() returns NULL when memory allocation fails. Currently,
> imx_card_probe() does not check for this case, which results in a NULL
> pointer dereference.
>
> Add NULL check after devm_kasprintf() to prevent this issue.
>
> Fixes: aa736700f42f ("ASoC: imx-card: Add imx-card machine driver")
> Signed-off-by: Henry Martin <bsdhenrymartin@...il.com>
> ---

Reviewed-by: Frank Li <Frank.Li@....com>

>  sound/soc/fsl/imx-card.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/sound/soc/fsl/imx-card.c b/sound/soc/fsl/imx-card.c
> index 905294682996..3686d468506b 100644
> --- a/sound/soc/fsl/imx-card.c
> +++ b/sound/soc/fsl/imx-card.c
> @@ -772,6 +772,8 @@ static int imx_card_probe(struct platform_device *pdev)
>  				data->dapm_routes[i].sink =
>  					devm_kasprintf(&pdev->dev, GFP_KERNEL, "%d %s",
>  						       i + 1, "Playback");
> +				if (!data->dapm_routes[i].sink)
> +					return -ENOMEM;
>  				data->dapm_routes[i].source = "CPU-Playback";
>  			}
>  		}
> @@ -789,6 +791,8 @@ static int imx_card_probe(struct platform_device *pdev)
>  				data->dapm_routes[i].source =
>  					devm_kasprintf(&pdev->dev, GFP_KERNEL, "%d %s",
>  						       i + 1, "Capture");
> +				if (!data->dapm_routes[i].source)
> +					return -ENOMEM;
>  				data->dapm_routes[i].sink = "CPU-Capture";
>  			}
>  		}
> --
> 2.34.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ