Author: simon Date: 2010-01-01 17:56:10 +0100 (Fri, 01 Jan 2010) New Revision: 1527
Modified: trunk/batman-adv-kernelland/originator.c trunk/batman-adv-kernelland/routing.c trunk/batman-adv-kernelland/soft-interface.c Log: batman-adv: Fix regressions found by Coccinelle
Some regressions which were found in the Coccinelle run by Julia Lawall are fixed in this patch. This includes:
* fix: use ETH_ALEN for mac address size in initialization * use kzalloc() instead of kmalloc() + memset() * remove unneccesary returns * return NETDEV_TX_OK in interface_tx()
Thanks to Andrew Lunn for informing us about that.
Signed-off-by: Simon Wunderlich siwu@hrz.tu-chemnitz.de
Modified: trunk/batman-adv-kernelland/originator.c =================================================================== --- trunk/batman-adv-kernelland/originator.c 2010-01-01 16:18:46 UTC (rev 1526) +++ trunk/batman-adv-kernelland/originator.c 2010-01-01 16:56:10 UTC (rev 1527) @@ -80,11 +80,10 @@
bat_dbg(DBG_BATMAN, "Creating new last-hop neighbor of originator\n");
- neigh_node = kmalloc(sizeof(struct neigh_node), GFP_ATOMIC); + neigh_node = kzalloc(sizeof(struct neigh_node), GFP_ATOMIC); if (!neigh_node) return NULL;
- memset(neigh_node, 0, sizeof(struct neigh_node)); INIT_LIST_HEAD(&neigh_node->list);
memcpy(neigh_node->addr, neigh, ETH_ALEN); @@ -131,11 +130,10 @@
bat_dbg(DBG_BATMAN, "Creating new originator: %pM \n", addr);
- orig_node = kmalloc(sizeof(struct orig_node), GFP_ATOMIC); + orig_node = kzalloc(sizeof(struct orig_node), GFP_ATOMIC); if (!orig_node) return NULL;
- memset(orig_node, 0, sizeof(struct orig_node)); INIT_LIST_HEAD(&orig_node->neigh_list);
memcpy(orig_node->orig, addr, ETH_ALEN); @@ -145,19 +143,15 @@
size = num_ifs * sizeof(TYPE_OF_WORD) * NUM_WORDS;
- orig_node->bcast_own = kmalloc(size, GFP_ATOMIC); + orig_node->bcast_own = kzalloc(size, GFP_ATOMIC); if (!orig_node->bcast_own) goto free_orig_node;
- memset(orig_node->bcast_own, 0, size); - size = num_ifs * sizeof(uint8_t); - orig_node->bcast_own_sum = kmalloc(size, GFP_ATOMIC); + orig_node->bcast_own_sum = kzalloc(size, GFP_ATOMIC); if (!orig_node->bcast_own_sum) goto free_bcast_own;
- memset(orig_node->bcast_own_sum, 0, size); - if (hash_add(orig_hash, orig_node) < 0) goto free_bcast_own_sum;
Modified: trunk/batman-adv-kernelland/routing.c =================================================================== --- trunk/batman-adv-kernelland/routing.c 2010-01-01 16:18:46 UTC (rev 1526) +++ trunk/batman-adv-kernelland/routing.c 2010-01-01 16:56:10 UTC (rev 1527) @@ -310,7 +310,6 @@
update_hna: update_routes(orig_node, orig_node->router, hna_buff, tmp_hna_buff_len); - return; }
static char count_real_packets(struct ethhdr *ethhdr,
Modified: trunk/batman-adv-kernelland/soft-interface.c =================================================================== --- trunk/batman-adv-kernelland/soft-interface.c 2010-01-01 16:18:46 UTC (rev 1526) +++ trunk/batman-adv-kernelland/soft-interface.c 2010-01-01 16:56:10 UTC (rev 1527) @@ -120,7 +120,7 @@
/* generate random address */ random_ether_addr(dev_addr); - memcpy(dev->dev_addr, dev_addr, sizeof(dev->dev_addr)); + memcpy(dev->dev_addr, dev_addr, ETH_ALEN);
SET_ETHTOOL_OPS(dev, &bat_ethtool_ops);
@@ -269,7 +269,7 @@ dropped: priv->stats.tx_dropped++; end: - return 0; + return NETDEV_TX_OK; }
void interface_rx(struct sk_buff *skb, int hdr_size) @@ -338,7 +338,6 @@
static void bat_set_msglevel(struct net_device *dev, u32 value) { - return; }
static u32 bat_get_link(struct net_device *dev)