Hey Andrew,
thanks for forwarding! I've commited a patch, revision 1527, which should fix these things. See some comments inline below.
best regards, Simon
On Thu, Dec 31, 2009 at 06:07:53PM +0100, Andrew Lunn wrote:
***dev->dev_addr is a pointer. The size of an address is probably 6. dev has an addr_len field that might be initialized.
fixed in r1527.
*** Use kzalloc instead of kmalloc + memset. Also consider testing the result of the kmaloc for NULL.
kzalloc is a good suggestion, done in r1527. kmalloc checking should be fixed in r1520, r1521, r1524.
*** As far as I can tell, in the following, the if after the out label is not needed.
correct, this was already fixed in r1493.
*** the result of kmalloc should be tested for NULL
correct, but not needed anymore as we have changed to static initialization in r1499.
diff -u -p /var/linuxes/linux-next/drivers/staging/batman-adv/translation-table.c /tmp/nothing --- /var/linuxes/linux-next/drivers/staging/batman-adv/translation-table.c 2009-12-19 09:38:58.000000000 +0100 @@ -322,7 +322,6 @@ void hna_global_add_orig(struct orig_nod if (orig_node->hna_buff_len > 0) { orig_node->hna_buff = kmalloc(orig_node->hna_buff_len, GFP_ATOMIC);
} else { orig_node->hna_buff = NULL; }memcpy(orig_node->hna_buff, hna_buff, orig_node->hna_buff_len);
this one again: kmalloc checking should be fixed in r1520, r1521, r1524.
returns.cocci
*** Perhaps there is no point to put a return by itself at the end of a function.
okay, done in r1527.
diff -u -p a/routing.c b/routing.c --- a/routing.c 2009-12-19 09:38:58.000000000 +0100 +++ b/routing.c 2009-12-31 14:59:41.000000000 +0100 @@ -627,7 +626,6 @@ static void recv_my_icmp_packet(struct e }
spin_unlock(&orig_hash_lock);
- return;
}
I did not find this return (probably due to the skb restructuring), but all the other useless returns; should be gone now (r1527).
static void recv_icmp_ttl_exceeded(struct icmp_packet *icmp_packet,
txok.cocci
*** I saw in some patch that functions store in the field .ndo_start_xmit ought to return NETDEV_TX_OK rather than 0. I haven't submitted any patches of my own for this situation, so I don't know for sure what the rule is.
OK, most drivers seem to do this, so we'll do the same (r1527)