[PATCH 3/3] firewire: cdev: use kzalloc_flex() to allocate structure with byte array
From: Takashi Sakamoto
Date: Mon Sep 28 2026 - 09:19:55 EST
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.
Signed-off-by: Takashi Sakamoto <o-takashi@xxxxxxxxxxxxx>
---
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;
--
2.53.0