[PATCH v2] ASoC: SDCA: bug fix while parsing mipi-sdca-control-cn-list
"struct sdca_control" declares "values" field as integer array. But the memory allocated to it is of char array. This causes crash for sdca_parse_function API. This patch addresses the issue by allocating correct data size.
Signed-off-by: Niranjan H Y niranjan.hy@ti.com --- v2: - use kcalloc instead of kzalloc --- sound/soc/sdca/sdca_functions.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sound/soc/sdca/sdca_functions.c b/sound/soc/sdca/sdca_functions.c index b2e3fab9b..49b98fe2d 100644 --- a/sound/soc/sdca/sdca_functions.c +++ b/sound/soc/sdca/sdca_functions.c @@ -950,7 +950,8 @@ static int find_sdca_entity_control(struct device *dev, struct sdca_entity *enti return ret; }
- control->values = devm_kzalloc(dev, hweight64(control->cn_list), GFP_KERNEL); + control->values = devm_kcalloc(dev, hweight64(control->cn_list), + sizeof(int), GFP_KERNEL); if (!control->values) return -ENOMEM;
On Mon, Nov 10, 2025 at 08:56:46PM +0530, Niranjan H Y wrote:
"struct sdca_control" declares "values" field as integer array. But the memory allocated to it is of char array. This causes crash for sdca_parse_function API. This patch addresses the issue by allocating correct data size.
Signed-off-by: Niranjan H Y niranjan.hy@ti.com
Reviewed-by: Charles Keepax ckeepax@opensource.cirrus.com
Thanks, Charles
On Mon, 10 Nov 2025 20:56:46 +0530, Niranjan H Y wrote:
"struct sdca_control" declares "values" field as integer array. But the memory allocated to it is of char array. This causes crash for sdca_parse_function API. This patch addresses the issue by allocating correct data size.
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: SDCA: bug fix while parsing mipi-sdca-control-cn-list commit: eb2d6774cc0d9d6ab8f924825695a85c14b2e0c2
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
On Mon, Nov 10, 2025 at 08:56:46PM +0530, Niranjan H Y wrote:
"struct sdca_control" declares "values" field as integer array. But the memory allocated to it is of char array. This causes crash for sdca_parse_function API. This patch addresses the issue by allocating correct data size.
Signed-off-by: Niranjan H Y niranjan.hy@ti.com
Looks good.
Fixes: 50a479527ef0 ("ASoC: SDCA: Add support for -cn- value properties")
regards, dan carpenter
participants (4)
-
Charles Keepax -
Dan Carpenter -
Mark Brown -
Niranjan H Y