ASoC: Intel: sof_sdw: Add NULL check in asoc_sdw_rt_dmic_rtd_init()
PATCH 1/1 ASoC: Intel: sof_sdw: Add NULL check in asoc_sdw_rt_dmic_rtd_init()
mic_name returned by devm_kasprintf() could be NULL. Add a check for it.
--- sound/soc/sdw_utils/soc_sdw_rt_dmic.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/sdw_utils/soc_sdw_rt_dmic.c +2 -0
@@ -29,6 +29,8 @@ int asoc_sdw_rt_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_da mic_name =devm_kasprintf (card->dev,GFP_KERNEL ,"rt715-sdca" ); else mic_name =devm_kasprintf (card->dev,GFP_KERNEL ,"%s" , component->name_prefix); +if (!mic_name) +return -ENOMEM ; card->components = devm_kasprintf(card->dev, GFP_KERNEL, "%s mic:%s", card->components,
Signature · 1 line
2.34.1
Quoted 2 lines
mic_namereturned bydevm_kasprintf()could be NULL. Add a check for it.
Was this patch also supported by the source code analysis tool “KNighter”?
…
sound/soc/sdw_utils/soc_sdw_rt_dmic.c int asoc_sdw_rt_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_da · line 31
Quoted 5 lines
+++
b/sound/soc/sdw_utils/soc_sdw_rt_dmic.csound/soc/sdw_utils/soc_sdw_rt_dmic.c +0
-0@@ -29,6 +29,8 @@ int asoc_sdw_rt_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_da mic_name =devm_kasprintf (card->dev,GFP_KERNEL ,"rt715-sdca" ); else mic_name =devm_kasprintf (card->dev,GFP_KERNEL ,"%s" , component->name_prefix);
…
How do you think about to use the function “devm_kstrdup” in one if branch instead (by another update step)?
https://elixir.bootlin.com/linux/v6.14-rc6/source/drivers/base/devres.c#L958-L965
Regards,
Markus
Mark Brown
maintainerQuoted 4 lines · Markus Elfring
Quoted 2 lines
mic_namereturned bydevm_kasprintf()could be NULL. Add a check for it.Was this patch also supported by the source code analysis tool “KNighter”?
Feel free to ignore Markus, he has a long history of sending unhelpful review comments and continues to ignore repeated requests to stop.
Mark Brown
maintainerQuoted 4 lines · Chenyuan Yang
mic_namereturned bydevm_kasprintf()could be NULL. Add a check for it.
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: Intel: sof_sdw: Add NULL check in asoc_sdw_rt_dmic_rtd_init()
commit: 68715cb5c0e00284d93f976c6368809f64131b0b
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