mirror of
https://git.openwrt.org/openwrt/openwrt.git
synced 2026-03-14 14:59:45 +01:00
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:
parent
63e0c89038
commit
08d2c0514f
1 changed files with 1 additions and 1 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue