mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ASoC: sigmadsp: Use flexible array for control cache
@ 2026-05-11 23:03 Rosen Penev
  2026-05-16  2:31 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Rosen Penev @ 2026-05-11 23:03 UTC (permalink / raw)
  To: linux-sound
  Cc: Lars-Peter Clausen, Nuno Sá,
	Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Kees Cook, Gustavo A. R. Silva, open list,
	open list:KERNEL HARDENING (not covered by other
	areas):Keyword:b__counted_by(_le|_be)?b

Allocate SigmaDSP controls with kzalloc_flex() for the trailing
cache data instead of open-coding the size calculation.

Annotate the cache array with its existing byte count so the allocation
helper can initialize the counter.

Assisted-by: Codex:GPT-5.5
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 sound/soc/codecs/sigmadsp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/sigmadsp.c b/sound/soc/codecs/sigmadsp.c
index 3343dbb63d2b..2e08fde3989c 100644
--- a/sound/soc/codecs/sigmadsp.c
+++ b/sound/soc/codecs/sigmadsp.c
@@ -35,7 +35,7 @@ struct sigmadsp_control {
 	struct snd_kcontrol *kcontrol;
 	bool is_readback;
 	bool cached;
-	uint8_t cache[];
+	u8 cache[] __counted_by(num_bytes);
 };
 
 struct sigmadsp_data {
@@ -223,7 +223,7 @@ static int sigma_fw_load_control(struct sigmadsp *sigmadsp,
 		return -EINVAL;
 
 	num_bytes = le16_to_cpu(ctrl_chunk->num_bytes);
-	ctrl = kzalloc(sizeof(*ctrl) + num_bytes, GFP_KERNEL);
+	ctrl = kzalloc_flex(*ctrl, cache, num_bytes);
 	if (!ctrl)
 		return -ENOMEM;
 
-- 
2.54.0


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

* Re: [PATCH] ASoC: sigmadsp: Use flexible array for control cache
  2026-05-11 23:03 [PATCH] ASoC: sigmadsp: Use flexible array for control cache Rosen Penev
@ 2026-05-16  2:31 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2026-05-16  2:31 UTC (permalink / raw)
  To: linux-sound, Rosen Penev
  Cc: Lars-Peter Clausen, Nuno Sá,
	Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kees Cook,
	Gustavo A. R. Silva, linux-kernel, linux-hardening

On Mon, 11 May 2026 16:03:51 -0700, Rosen Penev wrote:
> ASoC: sigmadsp: Use flexible array for control cache

Applied to

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

Thanks!

[1/1] ASoC: sigmadsp: Use flexible array for control cache
      https://git.kernel.org/broonie/sound/c/e0014849e9af

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

end of thread, other threads:[~2026-05-16  4:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-11 23:03 [PATCH] ASoC: sigmadsp: Use flexible array for control cache Rosen Penev
2026-05-16  2:31 ` Mark Brown

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

all inboxes | Powered by JetHome®