Skip to content

Commit 2c515c2

Browse files
nehebtiwai
authored andcommitted
ALSA: oss: Use flexible allocation for PCM plugins
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> Link: https://patch.msgid.link/20260519004647.627429-1-rosenp@gmail.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 1ab8e42 commit 2c515c2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

sound/core/oss/pcm_plugin.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ int snd_pcm_plugin_build(struct snd_pcm_substream *plug,
146146
return -ENXIO;
147147
if (snd_BUG_ON(!src_format || !dst_format))
148148
return -ENXIO;
149-
plugin = kzalloc(sizeof(*plugin) + extra, GFP_KERNEL);
149+
plugin = kzalloc_flex(*plugin, extra_data, extra);
150150
if (plugin == NULL)
151151
return -ENOMEM;
152152
plugin->name = name;

0 commit comments

Comments
 (0)