Skip to contentSkip to conversation

ASoC: qcom: Add checks for devm_kcalloc

PATCH In review Yuan Can 2 participants 2 messages Nov 24, 2022 – Nov 25, 2022

Subsystems (3)
lore
Share & tools
lore

Yuan Can

author
#0 lore raw

PATCH 1/1 ASoC: qcom: Add checks for devm_kcalloc

As the devm_kcalloc may return NULL, the return value needs to be checked to avoid NULL poineter dereference.

Fixes 24caf8d9eb10 ("ASoC: qcom: lpass-sc7180: Add platform driver for lpass audio")
---
 sound/soc/qcom/lpass-sc7180.c | 3 +++
 1 file changed, 3 insertions(+)
sound/soc/qcom/lpass-sc7180.c +3 -0
index 77a556b27cf0..24a1c121cb2e 100644
@@ -131,6 +131,9 @@ static int sc7180_lpass_init(struct platform_device *pdev)
 
 	drvdata->clks = devm_kcalloc(dev, variant->num_clks,
 				     sizeof(*drvdata->clks), GFP_KERNEL);
+	if (!drvdata->clks)
+		return -ENOMEM;
+
 	drvdata->num_clks = variant->num_clks;
 
 	for (i = 0; i < drvdata->num_clks; i++)
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 4 lines · Yuan Can

As the devm_kcalloc may return NULL, the return value needs to be checked to avoid NULL poineter dereference.

Applied to

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

Thanks!

[1/1] ASoC: qcom: Add checks for devm_kcalloc

      commit: 1bf5ee979076ceb121ee51c95197d890b1cee7f4

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