diff mbox series

ALSA: acp: check the return value of devm_kzalloc() in acp_legacy_dai_links_create()

Message ID 20220225131645.27556-1-baijiaju1990@gmail.com (mailing list archive)
State Accepted
Commit 431f9a77a4a62694ce90742d1f4c5abe1b8b6612
Headers show
Series ALSA: acp: check the return value of devm_kzalloc() in acp_legacy_dai_links_create() | expand

Commit Message

Jia-Ju Bai Feb. 25, 2022, 1:16 p.m. UTC
The function devm_kzalloc() in acp_legacy_dai_links_create() can fail,
so its return value should be checked.

Fixes: d4c750f2c7d4 ("ASoC: amd: acp: Add generic machine driver support for ACP cards")
Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
 sound/soc/amd/acp/acp-mach-common.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Mark Brown Feb. 25, 2022, 5:35 p.m. UTC | #1
On Fri, 25 Feb 2022 05:16:45 -0800, Jia-Ju Bai wrote:
> The function devm_kzalloc() in acp_legacy_dai_links_create() can fail,
> so its return value should be checked.
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ALSA: acp: check the return value of devm_kzalloc() in acp_legacy_dai_links_create()
      commit: 431f9a77a4a62694ce90742d1f4c5abe1b8b6612

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

diff --git a/sound/soc/amd/acp/acp-mach-common.c b/sound/soc/amd/acp/acp-mach-common.c
index cd05ee2802c9..5247015e8b31 100644
--- a/sound/soc/amd/acp/acp-mach-common.c
+++ b/sound/soc/amd/acp/acp-mach-common.c
@@ -556,6 +556,8 @@  int acp_legacy_dai_links_create(struct snd_soc_card *card)
 		num_links++;
 
 	links = devm_kzalloc(dev, sizeof(struct snd_soc_dai_link) * num_links, GFP_KERNEL);
+	if (!links)
+		return -ENOMEM;
 
 	if (drv_data->hs_cpu_id == I2S_SP) {
 		links[i].name = "acp-headset-codec";