From 704509b8d44886cebfbaff1a9813c35dfa986954 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Sat, 14 May 2011 23:14:54 +0200 Subject: 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 --- net/batman-adv/unicast.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'net/batman-adv/unicast.h') diff --git a/net/batman-adv/unicast.h b/net/batman-adv/unicast.h index 2ba867cf4135..62f54b954625 100644 --- a/net/batman-adv/unicast.h +++ b/net/batman-adv/unicast.h @@ -49,7 +49,7 @@ static inline int frag_can_reassemble(const struct sk_buff *skb, int mtu) uneven_correction = -1; } - merged_size = (skb->len - sizeof(struct unicast_frag_packet)) * 2; + merged_size = (skb->len - sizeof(*unicast_packet)) * 2; merged_size += sizeof(struct unicast_packet) + uneven_correction; return merged_size <= mtu; -- cgit v1.2.3-55-g7522