Skip to content

Commit cce8ec8

Browse files
nehebtiwai
authored andcommitted
ALSA: usb-audio: Use flexible allocation for FCP packets
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> Link: https://patch.msgid.link/20260519004834.627676-1-rosenp@gmail.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 2c515c2 commit cce8ec8

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

sound/usb/fcp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,13 @@ static int fcp_usb(struct usb_mixer_interface *mixer, u32 opcode,
191191

192192
struct fcp_usb_packet *req __free(kfree) = NULL;
193193
size_t req_buf_size = struct_size(req, data, req_size);
194-
req = kmalloc(req_buf_size, GFP_KERNEL);
194+
req = kmalloc_flex(*req, data, req_size);
195195
if (!req)
196196
return -ENOMEM;
197197

198198
struct fcp_usb_packet *resp __free(kfree) = NULL;
199199
size_t resp_buf_size = struct_size(resp, data, resp_size);
200-
resp = kmalloc(resp_buf_size, GFP_KERNEL);
200+
resp = kmalloc_flex(*resp, data, resp_size);
201201
if (!resp)
202202
return -ENOMEM;
203203

0 commit comments

Comments
 (0)