Skip to contentSkip to conversation

ASoC: qcom: Fix NULL Dereference in asoc_qcom_lpass_cpu_platform_probe()

PATCH In review Gax-c 2 participants 3 messages Oct 1, 2024 – Oct 8, 2024

Subsystems (5)
lore
Share & tools
lore

Gax-c

author
#0 lore raw

PATCH 1/1 ASoC: qcom: Fix NULL Dereference in asoc_qcom_lpass_cpu_platform_probe()

A devm_kzalloc() in asoc_qcom_lpass_cpu_platform_probe() could possibly return NULL pointer. NULL Pointer Dereference may be triggerred without addtional check.
Add a NULL check for the returned pointer.

Fixes b5022a36d28f ("ASoC: qcom: lpass: Use regmap_field for i2sctl and dmactl registers")
---
 sound/soc/qcom/lpass-cpu.c | 2 ++
 1 file changed, 2 insertions(+)
sound/soc/qcom/lpass-cpu.c +2 -0
index 5a47f661e0c6..242bc16da36d 100644
@@ -1242,6 +1242,8 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev)
 	/* Allocation for i2sctl regmap fields */
 	drvdata->i2sctl = devm_kzalloc(&pdev->dev, sizeof(struct lpaif_i2sctl),
 					GFP_KERNEL);
+	if (!drvdata->i2sctl)
+		return -ENOMEM;
 
 	/* Initialize bitfields for dai I2SCTL register */
 	ret = lpass_cpu_init_i2sctl_bitfields(dev, drvdata->i2sctl,
Signature · 1 line
2.25.1
#1 lore raw
Quoted 9 lines · Gax-c

A devm_kzalloc() in asoc_qcom_lpass_cpu_platform_probe() could possibly return NULL pointer. NULL Pointer Dereference may be triggerred without addtional check.
Add a NULL check for the returned pointer.

Fixes b5022a36d28f ("ASoC: qcom: lpass: Use regmap_field for i2sctl and dmactl registers")

Drop, you cannot report own work. To whom do you report it?

Was this compiled? Based on the previous work I have doubts.

Best regards,
Krzysztof

author
#2 lore raw
Quoted 2 lines

Drop, you cannot report own work. To whom do you report it?

I'll drop the report tag and re-commit. Thank you for your suggestion!

Was this compiled? Based on the previous work I have doubts.

Yes, it compiles. Sorry for putting you into such doubts.

Quoted 20 lines · Krzysztof Kozlowski
Quoted 6 lines · Gax-c

A devm_kzalloc() in asoc_qcom_lpass_cpu_platform_probe() could possibly return NULL pointer. NULL Pointer Dereference may be triggerred without addtional check.
Add a NULL check for the returned pointer.

Fixes b5022a36d28f ("ASoC: qcom: lpass: Use regmap_field for i2sctl and

dmactl registers")

Quoted 3 lines

Drop, you cannot report own work. To whom do you report it?

Was this compiled? Based on the previous work I have doubts.

Best regards,
Krzysztof