ASoC: qcom: lpass-cpu: use DAI table index for playback constraints
Subsystems (5)
PATCH v3 1/1 ASoC: qcom: lpass-cpu: use DAI table index for playback constraints
The DAI ID is a hardware port ID and is not necessarily the index of the corresponding entry in variant->dai_driver.
When configuring a DAI with LPAIF_I2SCTL_MODE_QUAD01, the probe code currently uses dai_id to index variant->dai_driver. This is incorrect for platforms where DAI IDs are sparse. For example, the IPQ806x MI2S DAI has ID 4 while it is the only entry in the DAI driver table. If that DAI is configured for QUAD01 and probe reaches this branch, the code writes beyond that single entry via dai_driver[4] instead of updating the DAI being processed.
Use the loop index i when updating the current DAI's playback channel constraints, while retaining dai_id for indexing the hardware-port specific playback SD-line mode array.
This fixes the incorrect DAI table access for platforms where the DAI ID does not match its position in the driver table.
---
Changes in v3:
- Describe the assistance in Assisted-by, no longer name the model.
Changes in v2:
- Add stable to Cc.
- Identify the model in the Assisted-by trailer (superseded in v3).
- Clarify the conditions for the IPQ806x out-of-bounds access.
The code change is unchanged from v1 and v2.
Compile-tested with LLVM for ARM using multi_v7_defconfig with CONFIG_SND_SOC_STORM=m. The lpass-cpu.o, lpass-ipq806x.o and lpass-platform.o targets built successfully. Not hardware-tested; the IPQ806x example is based on static analysis, not a reproduced crash.
sound/soc/qcom/lpass-cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/qcom/lpass-cpu.c +2 -2
@@ -1234,8 +1234,8 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev) }if (drvdata->mi2s_playback_sd_mode[dai_id] ==LPAIF_I2SCTL_MODE_QUAD01 ) { - variant->dai_driver[dai_id].playback.channels_min =4 ; - variant->dai_driver[dai_id].playback.channels_max =4 ; + variant->dai_driver[i].playback.channels_min =4 ; + variant->dai_driver[i].playback.channels_max =4 ; } }
base-commit: 0ed6f7f62318a581fe9698f8a4e98c7ca01160e4
Signature · 1 line
2.55.0
Quoted 15 lines · Zimeng Li
The DAI ID is a hardware port ID and is not necessarily the index of the corresponding entry in
variant->dai_driver.When configuring a DAI with
LPAIF_I2SCTL_MODE_QUAD01, the probe code currently usesdai_idto indexvariant->dai_driver. This is incorrect for platforms where DAI IDs are sparse. For example, the IPQ806x MI2S DAI has ID 4 while it is the only entry in the DAI driver table. If that DAI is configured for QUAD01 and probe reaches this branch, the code writes beyond that single entry via dai_driver[4] instead of updating the DAI being processed.Use the loop index i when updating the current DAI's playback channel constraints, while retaining
dai_idfor indexing the hardware-port specific playback SD-line mode array.
Quoted 8 lines
This fixes the incorrect DAI table access for platforms where the DAI ID does not match its position in the driver table.
Fixes c223f41c1a52 ("ASoC: qcom: Add four speaker support on MI2S secondary")Signed-off-by Zimeng Li <[email protected]>Assisted-by LLM-assisted source analysis---
--srini
Quoted 34 lines
Changes in v3:
- Describe the assistance in Assisted-by, no longer name the model.Changes in v2:
- Add stable to Cc.
- Identify the model in the Assisted-by trailer (superseded in v3).
- Clarify the conditions for the IPQ806x out-of-bounds access.The code change is unchanged from v1 and v2.
Compile-tested with LLVM for ARM usingmulti_v7_defconfigwithCONFIG_SND_SOC_STORM=m. The lpass-cpu.o, lpass-ipq806x.o and lpass-platform.o targets built successfully. Not hardware-tested; the IPQ806x example is based on static analysis, not a reproduced crash.sound/soc/qcom/lpass-cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)sound/soc/qcom/lpass-cpu.c +2
-2@@ -1234,8 +1234,8 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev) }if (drvdata->mi2s_playback_sd_mode[dai_id] ==LPAIF_I2SCTL_MODE_QUAD01 ) { - variant->dai_driver[dai_id].playback.channels_min =4 ; - variant->dai_driver[dai_id].playback.channels_max =4 ; + variant->dai_driver[i].playback.channels_min =4 ; + variant->dai_driver[i].playback.channels_max =4 ; } }base-commit:
0ed6f7f62318a581fe9698f8a4e98c7ca01160e4
Mark Brown
maintainerQuoted 1 line · Zimeng Li
ASoC: qcom: lpass-cpu: use DAI table index for playback constraints
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.3
Thanks!
[1/1] ASoC: qcom: lpass-cpu: use DAI table index for playback constraints
https://git.kernel.org/broonie/sound/c/ca51771c8efd
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