team: lb: use sizeof(*fprog) in __fprog_create
Subsystems (3)
PATCH 1/1 team: lb: use sizeof(*fprog) in __fprog_create
sock_fprog and sock_fprog_kern are of equal size, however it's cleaner to just use sizeof(*fprog) instead to always have correct type.
Reported-by Dan Carpenter <[email protected]>
Signed-off-by Daniel Borkmann <[email protected]>
--- drivers/net/team/team_mode_loadbalance.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/team/team_mode_loadbalance.c +1 -1
@@ -249,7 +249,7 @@ static int __fprog_create(struct sock_fprog_kern **pfprog, u32 data_len,if (data_len %sizeof (struct sock_filter ))return -EINVAL ; - fprog =kmalloc (sizeof (struct sock_fprog ),GFP_KERNEL ); + fprog =kmalloc (sizeof (*fprog),GFP_KERNEL );if (!fprog)return -ENOMEM ; fprog->filter =kmemdup (filter, data_len,GFP_KERNEL );
Signature · 1 line
1.7.11.7
From: Daniel Borkmann <[email protected]>
Date: Sat, 24 May 2014 21:47:46 +0200
Quoted 6 lines
sock_fprogandsock_fprog_kernare of equal size, however it's cleaner to just usesizeof(*fprog)instead to always have correct type.Reported-by Dan Carpenter <[email protected]>Signed-off-by Daniel Borkmann <[email protected]>
Applied, thanks Daniel.