From: Rosen Penev <rosenp@gmail.com>
To: linux-sound@vger.kernel.org
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH] ALSA: oss: Use flexible allocation for PCM plugins
Date: Mon, 18 May 2026 17:46:47 -0700 [thread overview]
Message-ID: <20260519004647.627429-1-rosenp@gmail.com> (raw)
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
next reply other threads:[~2026-05-19 0:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-19 0:46 Rosen Penev [this message]
2026-05-19 6:06 ` [PATCH] ALSA: oss: Use flexible allocation for PCM plugins Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260519004647.627429-1-rosenp@gmail.com \
--to=rosenp@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.