From 8487a3a876eea696f1eaf4b477d2e9cc336bc436 Mon Sep 17 00:00:00 2001 From: Takashi Sakamoto Date: Mon, 28 Sep 2026 21:57:17 +0900 Subject: [PATCH] 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 --- drivers/firewire/core-cdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c index caabaaf99cb7..60067c5b1973 100644 --- a/drivers/firewire/core-cdev.c +++ b/drivers/firewire/core-cdev.c @@ -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;