ASoC: simple-card: Dereference pointer for memcpy sizeof in asoc_simple_card_probe
Kuninori Morimoto
maintainerPATCH v2 1/1 ASoC: simple-card: Dereference pointer for memcpy sizeof in asoc_simple_card_probe
From: Nathan Chancellor <[email protected]>
Commit 4fb7f4df49d3 ("ASoC: simple-card: use cpu/codec pointer on simple_dai_props") updated {cpu,codec}_dai to be pointers in struct simple_dai_props but didn't update these locations to dereference the pointers.
This patch fixup it for non DT simple-card use case.
--- sound/soc/generic/simple-card.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
sound/soc/generic/simple-card.c +8 -4
@@ -665,6 +665,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev)struct asoc_simple_card_info *cinfo;struct snd_soc_dai_link_component *codecs;struct snd_soc_dai_link_component *platform; +int dai_idx =0 ; cinfo = dev->platform_data;if (!cinfo) {
@@ -681,6 +682,9 @@ static int asoc_simple_card_probe(struct platform_device *pdev)return -EINVAL ; } + dai_props->cpu_dai = &priv->dais[dai_idx++]; + dai_props->codec_dai = &priv->dais[dai_idx++]; + codecs = dai_link->codecs; codecs->name = cinfo->codec; codecs->dai_name = cinfo->codec_dai.name;
@@ -694,10 +698,10 @@ static int asoc_simple_card_probe(struct platform_device *pdev) dai_link->cpu_dai_name = cinfo->cpu_dai.name; dai_link->dai_fmt = cinfo->daifmt; dai_link->init = asoc_simple_card_dai_init; -memcpy (&priv->dai_props->cpu_dai, &cinfo->cpu_dai, -sizeof (priv->dai_props->cpu_dai)); -memcpy (&priv->dai_props->codec_dai, &cinfo->codec_dai, -sizeof (priv->dai_props->codec_dai)); +memcpy (priv->dai_props->cpu_dai, &cinfo->cpu_dai, +sizeof (*priv->dai_props->cpu_dai)); +memcpy (priv->dai_props->codec_dai, &cinfo->codec_dai, +sizeof (*priv->dai_props->codec_dai)); }snd_soc_card_set_drvdata (card, priv);
Signature · 1 line
2.7.4
Mark Brown
maintainerApplied "ASoC: simple-card: Dereference pointer for memcpy sizeof in asoc_simple_card_probe" to the asoc tree
The patch
ASoC: simple-card: Dereference pointer for memcpy sizeof in asoc_simple_card_probe
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
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
Quoted 1 line
From
869858f84a65b646052eff1ec75c1f49e638b62bMon Sep 17 00:00:00 2001
From: Nathan Chancellor <[email protected]>
Date: Thu, 13 Dec 2018 14:15:20 +0900
Subject: [PATCH] ASoC: simple-card: Dereference pointer for memcpy sizeof in
asoc_simple_card_probe
Commit 4fb7f4df49d3 ("ASoC: simple-card: use cpu/codec pointer on simple_dai_props") updated {cpu,codec}_dai to be pointers in struct simple_dai_props but didn't update these locations to dereference the pointers.
This patch fixup it for non DT simple-card use case.
--- sound/soc/generic/simple-card.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
sound/soc/generic/simple-card.c +8 -4
@@ -429,6 +429,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev)struct asoc_simple_card_info *cinfo;struct snd_soc_dai_link_component *codecs;struct snd_soc_dai_link_component *platform; +int dai_idx =0 ; cinfo = dev->platform_data;if (!cinfo) {
@@ -445,6 +446,9 @@ static int asoc_simple_card_probe(struct platform_device *pdev)return -EINVAL ; } + dai_props->cpu_dai = &priv->dais[dai_idx++]; + dai_props->codec_dai = &priv->dais[dai_idx++]; + codecs = dai_link->codecs; codecs->name = cinfo->codec; codecs->dai_name = cinfo->codec_dai.name;
@@ -458,10 +462,10 @@ static int asoc_simple_card_probe(struct platform_device *pdev) dai_link->cpu_dai_name = cinfo->cpu_dai.name; dai_link->dai_fmt = cinfo->daifmt; dai_link->init = asoc_simple_card_dai_init; -memcpy (&priv->dai_props->cpu_dai, &cinfo->cpu_dai, -sizeof (priv->dai_props->cpu_dai)); -memcpy (&priv->dai_props->codec_dai, &cinfo->codec_dai, -sizeof (priv->dai_props->codec_dai)); +memcpy (priv->dai_props->cpu_dai, &cinfo->cpu_dai, +sizeof (*priv->dai_props->cpu_dai)); +memcpy (priv->dai_props->codec_dai, &cinfo->codec_dai, +sizeof (*priv->dai_props->codec_dai)); }snd_soc_card_set_drvdata (card, priv);
Signature · 1 line
2.19.0.rc2