team: lb: use sizeof(*fprog) in __fprog_create
authorDaniel Borkmann <dborkman@redhat.com>
Sat, 24 May 2014 19:47:46 +0000 (21:47 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 24 May 2014 21:06:38 +0000 (17:06 -0400)
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 <dan.carpenter@oracle.com>
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/team/team_mode_loadbalance.c

index 0a6ee07bf0af4bf490c0c41eaf19b157eaea1c4b..a58dfebb5512326db7065a433c37676c99820407 100644 (file)
@@ -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);