firewire: cdev: use kzalloc_flex() to allocate structure with byte array

Some event structures have a trailing flexible array member of bytes to
store event-specific data. Use kzalloc_flex() to allocate the structure
together with storage for the flexible array member.

Link: https://lore.kernel.org/r/20260928125718.50974-4-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
This commit is contained in:
Takashi Sakamoto 2026-09-28 21:57:17 +09:00
parent b1790574d3
commit 8487a3a876

View File

@ -1020,7 +1020,7 @@ static void iso_callback(struct fw_iso_context *context, u32 cycle,
struct client *client = data;
struct iso_interrupt_event *e;
e = kmalloc(sizeof(*e) + header_length, GFP_KERNEL);
e = kzalloc_flex(*e, interrupt.header, header_length);
if (e == NULL)
return;