* [PATCH] ALSA: usb-audio: Use flexible allocation for FCP packets
@ 2026-05-19 0:48 Rosen Penev
2026-05-19 6:06 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Rosen Penev @ 2026-05-19 0:48 UTC (permalink / raw)
To: linux-sound; +Cc: Geoffrey D. Bennett, Jaroslav Kysela, Takashi Iwai, open list
Allocate FCP request and response packets with kmalloc_flex() for
the trailing packet data instead of passing the computed struct size
directly to kmalloc().
Keep the computed packet sizes for the USB transfer length checks.
Assisted-by: Codex:GPT-5.5
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
sound/usb/fcp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/usb/fcp.c b/sound/usb/fcp.c
index 0fc4d063c48a..ea746bdb36ff 100644
--- a/sound/usb/fcp.c
+++ b/sound/usb/fcp.c
@@ -191,13 +191,13 @@ static int fcp_usb(struct usb_mixer_interface *mixer, u32 opcode,
struct fcp_usb_packet *req __free(kfree) = NULL;
size_t req_buf_size = struct_size(req, data, req_size);
- req = kmalloc(req_buf_size, GFP_KERNEL);
+ req = kmalloc_flex(*req, data, req_size);
if (!req)
return -ENOMEM;
struct fcp_usb_packet *resp __free(kfree) = NULL;
size_t resp_buf_size = struct_size(resp, data, resp_size);
- resp = kmalloc(resp_buf_size, GFP_KERNEL);
+ resp = kmalloc_flex(*resp, data, resp_size);
if (!resp)
return -ENOMEM;
--
2.54.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] ALSA: usb-audio: Use flexible allocation for FCP packets
2026-05-19 0:48 [PATCH] ALSA: usb-audio: Use flexible allocation for FCP packets 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, Geoffrey D. Bennett, Jaroslav Kysela, Takashi Iwai,
open list
On Tue, 19 May 2026 02:48:34 +0200,
Rosen Penev wrote:
>
> Allocate FCP request and response packets with kmalloc_flex() for
> the trailing packet data instead of passing the computed struct size
> directly to kmalloc().
>
> Keep the computed packet sizes for the USB transfer length checks.
>
> 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:48 [PATCH] ALSA: usb-audio: Use flexible allocation for FCP packets Rosen Penev
2026-05-19 6:06 ` Takashi Iwai
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®