linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: simple-card-utils: Avoid over-allocating DLCs
@ 2021-08-05  5:07 Samuel Holland
  2021-08-05  5:14 ` Kuninori Morimoto
  2021-08-06  0:47 ` Mark Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Samuel Holland @ 2021-08-05  5:07 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown
  Cc: Kuninori Morimoto, alsa-devel, linux-kernel, Samuel Holland

The allocation of the DAI link components (DLCs) passed the wrong
pointer to sizeof. Since simple_dai_props is much larger than
snd_soc_dai_link_component, there was no out of bounds access, only
wasted memory.

Signed-off-by: Samuel Holland <samuel@sholland.org>
---
 sound/soc/generic/simple-card-utils.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
index 677f7da93b4b..10c63b73900c 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -640,8 +640,8 @@ int asoc_simple_init_priv(struct asoc_simple_priv *priv,
 			cnf_num += li->num[i].codecs;
 	}
 
-	dais = devm_kcalloc(dev, dai_num, sizeof(*dais),      GFP_KERNEL);
-	dlcs = devm_kcalloc(dev, dlc_num, sizeof(*dai_props), GFP_KERNEL);
+	dais = devm_kcalloc(dev, dai_num, sizeof(*dais), GFP_KERNEL);
+	dlcs = devm_kcalloc(dev, dlc_num, sizeof(*dlcs), GFP_KERNEL);
 	if (!dais || !dlcs)
 		return -ENOMEM;
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: simple-card-utils: Avoid over-allocating DLCs
  2021-08-05  5:07 [PATCH] ASoC: simple-card-utils: Avoid over-allocating DLCs Samuel Holland
@ 2021-08-05  5:14 ` Kuninori Morimoto
  2021-08-05 12:32   ` Mark Brown
  2021-08-06  0:47 ` Mark Brown
  1 sibling, 1 reply; 4+ messages in thread
From: Kuninori Morimoto @ 2021-08-05  5:14 UTC (permalink / raw)
  To: Samuel Holland; +Cc: Liam Girdwood, Mark Brown, alsa-devel, linux-kernel


Hi Samuel

Thank you for your patch

> The allocation of the DAI link components (DLCs) passed the wrong
> pointer to sizeof. Since simple_dai_props is much larger than
> snd_soc_dai_link_component, there was no out of bounds access, only
> wasted memory.
> 
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> ---

Wow indeed !
Thank you for your fixup

	Fixes: f2138aed231c8 ("ASoC: simple-card-utils: enable flexible CPU/Codec/Platform")
	Fixes: 050c7950fd706 ("ASoC: simple-card-utils: alloc dai_link information for CPU/Codec/Platform")
	Reviewed-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

>  sound/soc/generic/simple-card-utils.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
> index 677f7da93b4b..10c63b73900c 100644
> --- a/sound/soc/generic/simple-card-utils.c
> +++ b/sound/soc/generic/simple-card-utils.c
> @@ -640,8 +640,8 @@ int asoc_simple_init_priv(struct asoc_simple_priv *priv,
>  			cnf_num += li->num[i].codecs;
>  	}
>  
> -	dais = devm_kcalloc(dev, dai_num, sizeof(*dais),      GFP_KERNEL);
> -	dlcs = devm_kcalloc(dev, dlc_num, sizeof(*dai_props), GFP_KERNEL);
> +	dais = devm_kcalloc(dev, dai_num, sizeof(*dais), GFP_KERNEL);
> +	dlcs = devm_kcalloc(dev, dlc_num, sizeof(*dlcs), GFP_KERNEL);
>  	if (!dais || !dlcs)
>  		return -ENOMEM;
>  
> -- 
> 2.31.1
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: simple-card-utils: Avoid over-allocating DLCs
  2021-08-05  5:14 ` Kuninori Morimoto
@ 2021-08-05 12:32   ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2021-08-05 12:32 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Samuel Holland, Liam Girdwood, alsa-devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 233 bytes --]

On Thu, Aug 05, 2021 at 02:14:53PM +0900, Kuninori Morimoto wrote:

> 	Reviewed-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

If you put spaces at the start of the line then none of the tooling will
pick up tags you add.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: simple-card-utils: Avoid over-allocating DLCs
  2021-08-05  5:07 [PATCH] ASoC: simple-card-utils: Avoid over-allocating DLCs Samuel Holland
  2021-08-05  5:14 ` Kuninori Morimoto
@ 2021-08-06  0:47 ` Mark Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2021-08-06  0:47 UTC (permalink / raw)
  To: Samuel Holland, Liam Girdwood
  Cc: Mark Brown, linux-kernel, Kuninori Morimoto, alsa-devel

On Thu, 5 Aug 2021 00:07:06 -0500, Samuel Holland wrote:
> The allocation of the DAI link components (DLCs) passed the wrong
> pointer to sizeof. Since simple_dai_props is much larger than
> snd_soc_dai_link_component, there was no out of bounds access, only
> wasted memory.
> 
> 
> 
> [...]

Applied to

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

Thanks!

[1/1] ASoC: simple-card-utils: Avoid over-allocating DLCs
      commit: 36a9d79e5e9518dfd9548e3237e7a49464c16922

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-06  0:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-05  5:07 [PATCH] ASoC: simple-card-utils: Avoid over-allocating DLCs Samuel Holland
2021-08-05  5:14 ` Kuninori Morimoto
2021-08-05 12:32   ` Mark Brown
2021-08-06  0:47 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).