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>
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 802eace..561f769 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -164,7 +164,7 @@
bat_dbg(DBG_ROUTES, bat_priv,
"Creating new local tt entry: %pM\n", addr);
- tt_local_entry = kmalloc(sizeof(struct tt_local_entry), GFP_ATOMIC);
+ tt_local_entry = kmalloc(sizeof(*tt_local_entry), GFP_ATOMIC);
if (!tt_local_entry)
return;
@@ -427,9 +427,8 @@
if (!tt_global_entry) {
spin_unlock_bh(&bat_priv->tt_ghash_lock);
- tt_global_entry =
- kmalloc(sizeof(struct tt_global_entry),
- GFP_ATOMIC);
+ tt_global_entry = kmalloc(sizeof(*tt_global_entry),
+ GFP_ATOMIC);
if (!tt_global_entry)
break;