trelay: use struct_size helper in allocation

Makes it clear that the allocation is dealing with a flex array member.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21960
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Rosen Penev authored and Robert Marko committed 2026-03-13 19:58:05 +01:00
1 parent 63e0c89038
commit 08d2c0514f
1 file changed
+1 -1
+1 -1
View File
@@ -152,7 +152,7 @@ static int trelay_do_add(char *name, char *devn1, char *devn2)
struct trelay *tr, *tr1;
int ret;
tr = kzalloc(sizeof(*tr) + strlen(name) + 1, GFP_KERNEL);
tr = kzalloc(struct_size(tr, name, strlen(name) + 1), GFP_KERNEL);
if (!tr)
return -ENOMEM;