diff options
author | Sven Eckelmann <sven@narfation.org> | 2011-05-14 17:14:54 -0400 |
---|---|---|
committer | Sven Eckelmann <sven@narfation.org> | 2011-05-30 01:39:33 -0400 |
commit | 704509b8d44886cebfbaff1a9813c35dfa986954 (patch) | |
tree | 7b353f1d4a33b31d55d2a85f8d70882ade1868ce /net/batman-adv/icmp_socket.c | |
parent | 958ca5985604a6f13387d32de489365df816558b (diff) |
batman-adv: Calculate sizeof using variable insead of types
Documentation/CodingStyle recommends to use the form
p = kmalloc(sizeof(*p), ...);
to calculate the size of a struct and not the version where the struct
name is spelled out to prevent bugs when the type of p changes. This
also seems appropriate for manipulation of buffers when they are
directly associated with p.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Diffstat (limited to 'net/batman-adv/icmp_socket.c')
-rw-r--r-- | net/batman-adv/icmp_socket.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/batman-adv/icmp_socket.c b/net/batman-adv/icmp_socket.c index fa22ba2bb832..ac3520e057c0 100644 --- a/net/batman-adv/icmp_socket.c +++ b/net/batman-adv/icmp_socket.c | |||
@@ -46,7 +46,7 @@ static int bat_socket_open(struct inode *inode, struct file *file) | |||
46 | 46 | ||
47 | nonseekable_open(inode, file); | 47 | nonseekable_open(inode, file); |
48 | 48 | ||
49 | socket_client = kmalloc(sizeof(struct socket_client), GFP_KERNEL); | 49 | socket_client = kmalloc(sizeof(*socket_client), GFP_KERNEL); |
50 | 50 | ||
51 | if (!socket_client) | 51 | if (!socket_client) |
52 | return -ENOMEM; | 52 | return -ENOMEM; |
@@ -310,7 +310,7 @@ static void bat_socket_add_packet(struct socket_client *socket_client, | |||
310 | { | 310 | { |
311 | struct socket_packet *socket_packet; | 311 | struct socket_packet *socket_packet; |
312 | 312 | ||
313 | socket_packet = kmalloc(sizeof(struct socket_packet), GFP_ATOMIC); | 313 | socket_packet = kmalloc(sizeof(*socket_packet), GFP_ATOMIC); |
314 | 314 | ||
315 | if (!socket_packet) | 315 | if (!socket_packet) |
316 | return; | 316 | return; |