On Saturday, March 24, 2012 22:39:45 Andrew Lunn wrote:
- if (skb->len < min_len) {
memset(elp_neigh_entry, 0, min_len - skb->len);
skb_put(skb, min_len - skb->len);
- }
I don't know the skbuf code too well, maybe you know it better than me.
Is this memset needed? The skb is a copy of the template ELP packet created then the soft interface is created. So if the contents of the template is set to 0, should we be able to skip this zeroing here?
skb_copy() does not initialize the skb with zeros as far as I can tell. bat_v_elp_iface_enable() only writes zeros into the ELP header (BATMAN_ELP_HLEN), so zeroing the rest of the skb seems correct. We could zero the entire skb in bat_v_elp_iface_enable() to save the memset.
Regards, Marek