Skip to contentSkip to conversation

team: lb: use sizeof(*fprog) in __fprog_create

PATCH Applied Daniel Borkmann 2 participants 2 messages May 24, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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.

---
 drivers/net/team/team_mode_loadbalance.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/team/team_mode_loadbalance.c +1 -1
index 0a6ee07..a58dfeb 100644
@@ -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