Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next] team: lb: use sizeof(*fprog) in __fprog_create
@ 2014-05-24 19:47 Daniel Borkmann
  2014-05-24 21:07 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Borkmann @ 2014-05-24 19:47 UTC (permalink / raw)
  To: davem; +Cc: dan.carpenter, netdev

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

diff --git a/drivers/net/team/team_mode_loadbalance.c b/drivers/net/team/team_mode_loadbalance.c
index 0a6ee07..a58dfeb 100644
--- a/drivers/net/team/team_mode_loadbalance.c
+++ b/drivers/net/team/team_mode_loadbalance.c
@@ -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);
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] team: lb: use sizeof(*fprog) in __fprog_create
  2014-05-24 19:47 [PATCH net-next] team: lb: use sizeof(*fprog) in __fprog_create Daniel Borkmann
@ 2014-05-24 21:07 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-05-24 21:07 UTC (permalink / raw)
  To: dborkman; +Cc: dan.carpenter, netdev

From: Daniel Borkmann <dborkman@redhat.com>
Date: Sat, 24 May 2014 21:47:46 +0200

> 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>

Applied, thanks Daniel.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-05-24 21:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-24 19:47 [PATCH net-next] team: lb: use sizeof(*fprog) in __fprog_create Daniel Borkmann
2014-05-24 21:07 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox