All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: oss: Use flexible allocation for PCM plugins
@ 2026-05-19  0:46 Rosen Penev
  2026-05-19  6:06 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Rosen Penev @ 2026-05-19  0:46 UTC (permalink / raw)
  To: linux-sound; +Cc: Jaroslav Kysela, Takashi Iwai, open list

Allocate PCM plugin objects with kzalloc_flex() for the trailing
extra data area instead of open-coding the size calculation.

This keeps the allocation tied to the existing flexible array member
without changing the plugin lifetime.

Assisted-by: Codex:GPT-5.5
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 sound/core/oss/pcm_plugin.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/core/oss/pcm_plugin.c b/sound/core/oss/pcm_plugin.c
index 14b4a390a219..5f4d6945a7df 100644
--- a/sound/core/oss/pcm_plugin.c
+++ b/sound/core/oss/pcm_plugin.c
@@ -146,7 +146,7 @@ int snd_pcm_plugin_build(struct snd_pcm_substream *plug,
 		return -ENXIO;
 	if (snd_BUG_ON(!src_format || !dst_format))
 		return -ENXIO;
-	plugin = kzalloc(sizeof(*plugin) + extra, GFP_KERNEL);
+	plugin = kzalloc_flex(*plugin, extra_data, extra);
 	if (plugin == NULL)
 		return -ENOMEM;
 	plugin->name = name;
-- 
2.54.0


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

* Re: [PATCH] ALSA: oss: Use flexible allocation for PCM plugins
  2026-05-19  0:46 [PATCH] ALSA: oss: Use flexible allocation for PCM plugins Rosen Penev
@ 2026-05-19  6:06 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2026-05-19  6:06 UTC (permalink / raw)
  To: Rosen Penev; +Cc: linux-sound, Jaroslav Kysela, Takashi Iwai, open list

On Tue, 19 May 2026 02:46:47 +0200,
Rosen Penev wrote:
> 
> Allocate PCM plugin objects with kzalloc_flex() for the trailing
> extra data area instead of open-coding the size calculation.
> 
> This keeps the allocation tied to the existing flexible array member
> without changing the plugin lifetime.
> 
> Assisted-by: Codex:GPT-5.5
> Signed-off-by: Rosen Penev <rosenp@gmail.com>

Applied to for-next branch.  Thanks.


Takashi

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

end of thread, other threads:[~2026-05-19  6:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-19  0:46 [PATCH] ALSA: oss: Use flexible allocation for PCM plugins Rosen Penev
2026-05-19  6:06 ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.