mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
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>
This commit is contained in:
parent
2c515c221a
commit
cce8ec8209
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user