diff options
| author | Henry Martin <bsdhenrymartin@gmail.com> | 2025-04-01 22:25:10 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-04-10 14:44:39 +0200 |
| commit | dd2bbb9564d0d24a2643ad90008a79840368c4b4 (patch) | |
| tree | 466c25d50ab73fcdd436669d3c35af3b3ad584f4 /sound | |
| parent | c2e44807ff0cea5fd64139224f83c6160c49b078 (diff) | |
| download | linux-dd2bbb9564d0d24a2643ad90008a79840368c4b4.tar.gz linux-dd2bbb9564d0d24a2643ad90008a79840368c4b4.tar.bz2 linux-dd2bbb9564d0d24a2643ad90008a79840368c4b4.zip | |
ASoC: imx-card: Add NULL check in imx_card_probe()
[ Upstream commit 93d34608fd162f725172e780b1c60cc93a920719 ]
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@gmail.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20250401142510.29900-1-bsdhenrymartin@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'sound')
| -rw-r--r-- | sound/soc/fsl/imx-card.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sound/soc/fsl/imx-card.c b/sound/soc/fsl/imx-card.c index ac043ad367ac..21f617f6f9fa 100644 --- a/sound/soc/fsl/imx-card.c +++ b/sound/soc/fsl/imx-card.c @@ -767,6 +767,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"; } } @@ -784,6 +786,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"; } } |
