public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: Intel: avs: Fix kcalloc() sizes
@ 2025-04-26 14:13 Thorsten Blum
  2025-04-28  7:39 ` Amadeusz Sławiński
  2025-05-01  5:43 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Thorsten Blum @ 2025-04-26 14:13 UTC (permalink / raw)
  To: Cezary Rojewski, Liam Girdwood, Peter Ujfalusi, Bard Liao,
	Ranjani Sridharan, Kai Vehmanen, Pierre-Louis Bossart, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, Amadeusz Sławiński,
	Piotr Maziarz
  Cc: Thorsten Blum, linux-sound, linux-kernel

rlist, clist, and slist are allocated using sizeof(pointer) instead of
sizeof(*pointer). Fix the allocations by using sizeof(*pointer) and
avoid overallocating memory on 64-bit systems.

Fixes: f2f847461fb7 ("ASoC: Intel: avs: Constrain path based on BE capabilities")
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 sound/soc/intel/avs/path.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/intel/avs/path.c b/sound/soc/intel/avs/path.c
index cafb8c6198be..8f1bf8d0af8f 100644
--- a/sound/soc/intel/avs/path.c
+++ b/sound/soc/intel/avs/path.c
@@ -131,9 +131,9 @@ int avs_path_set_constraint(struct avs_dev *adev, struct avs_tplg_path_template
 	list_for_each_entry(path_template, &template->path_list, node)
 		i++;
 
-	rlist = kcalloc(i, sizeof(rlist), GFP_KERNEL);
-	clist = kcalloc(i, sizeof(clist), GFP_KERNEL);
-	slist = kcalloc(i, sizeof(slist), GFP_KERNEL);
+	rlist = kcalloc(i, sizeof(*rlist), GFP_KERNEL);
+	clist = kcalloc(i, sizeof(*clist), GFP_KERNEL);
+	slist = kcalloc(i, sizeof(*slist), GFP_KERNEL);
 
 	i = 0;
 	list_for_each_entry(path_template, &template->path_list, node) {
-- 
2.49.0


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

* Re: [PATCH] ASoC: Intel: avs: Fix kcalloc() sizes
  2025-04-26 14:13 [PATCH] ASoC: Intel: avs: Fix kcalloc() sizes Thorsten Blum
@ 2025-04-28  7:39 ` Amadeusz Sławiński
  2025-05-01  5:43 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Amadeusz Sławiński @ 2025-04-28  7:39 UTC (permalink / raw)
  To: Thorsten Blum, Cezary Rojewski, Liam Girdwood, Peter Ujfalusi,
	Bard Liao, Ranjani Sridharan, Kai Vehmanen, Pierre-Louis Bossart,
	Mark Brown, Jaroslav Kysela, Takashi Iwai, Piotr Maziarz
  Cc: linux-sound, linux-kernel

On 2025-04-26 16:13, Thorsten Blum wrote:
> rlist, clist, and slist are allocated using sizeof(pointer) instead of
> sizeof(*pointer). Fix the allocations by using sizeof(*pointer) and
> avoid overallocating memory on 64-bit systems.
> 
> Fixes: f2f847461fb7 ("ASoC: Intel: avs: Constrain path based on BE capabilities")
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
>   sound/soc/intel/avs/path.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/sound/soc/intel/avs/path.c b/sound/soc/intel/avs/path.c
> index cafb8c6198be..8f1bf8d0af8f 100644
> --- a/sound/soc/intel/avs/path.c
> +++ b/sound/soc/intel/avs/path.c
> @@ -131,9 +131,9 @@ int avs_path_set_constraint(struct avs_dev *adev, struct avs_tplg_path_template
>   	list_for_each_entry(path_template, &template->path_list, node)
>   		i++;
>   
> -	rlist = kcalloc(i, sizeof(rlist), GFP_KERNEL);
> -	clist = kcalloc(i, sizeof(clist), GFP_KERNEL);
> -	slist = kcalloc(i, sizeof(slist), GFP_KERNEL);
> +	rlist = kcalloc(i, sizeof(*rlist), GFP_KERNEL);
> +	clist = kcalloc(i, sizeof(*clist), GFP_KERNEL);
> +	slist = kcalloc(i, sizeof(*slist), GFP_KERNEL);
>   
>   	i = 0;
>   	list_for_each_entry(path_template, &template->path_list, node) {

Of course, thanks!

Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>


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

* Re: [PATCH] ASoC: Intel: avs: Fix kcalloc() sizes
  2025-04-26 14:13 [PATCH] ASoC: Intel: avs: Fix kcalloc() sizes Thorsten Blum
  2025-04-28  7:39 ` Amadeusz Sławiński
@ 2025-05-01  5:43 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2025-05-01  5:43 UTC (permalink / raw)
  To: Cezary Rojewski, Liam Girdwood, Peter Ujfalusi, Bard Liao,
	Ranjani Sridharan, Kai Vehmanen, Pierre-Louis Bossart,
	Jaroslav Kysela, Takashi Iwai, Amadeusz Sławiński,
	Piotr Maziarz, Thorsten Blum
  Cc: linux-sound, linux-kernel

On Sat, 26 Apr 2025 16:13:41 +0200, Thorsten Blum wrote:
> rlist, clist, and slist are allocated using sizeof(pointer) instead of
> sizeof(*pointer). Fix the allocations by using sizeof(*pointer) and
> avoid overallocating memory on 64-bit systems.
> 
> 

Applied to

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

Thanks!

[1/1] ASoC: Intel: avs: Fix kcalloc() sizes
      commit: d20df86b056b95845f6ed52da1010059202a0c23

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] 3+ messages in thread

end of thread, other threads:[~2025-05-01  5:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-26 14:13 [PATCH] ASoC: Intel: avs: Fix kcalloc() sizes Thorsten Blum
2025-04-28  7:39 ` Amadeusz Sławiński
2025-05-01  5:43 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox