Hello Marek,
On Tue, Oct 02, 2012 at 01:16:40PM +0800, Marek Lindner wrote:
On Tuesday, October 02, 2012 04:53:28 Simon Wunderlich wrote:
+#define skb_share_check(skb, b) \
skb_share_check(skb, b); \
if (skb) \
skb_reset_mac_len(skb)
+#endif /* < KERNEL_VERSION(3, 8, 0) */
Has this patch been tested ? Our skb_share_check() call is this: skb = skb_share_check(skb, GFP_ATOMIC);
Now we replace this function call with 2 function calls and 2 return values ?
I have not tested in a real machine, but only the first function will return the skb. The second part is a separate statement. I've checked it with gcc -E (preprocessor only), these lines in main.c will expand to:
hard_iface = ({ const typeof( ((struct batadv_hard_iface *)0)->batman_adv_ptype ) *__mptr = (ptype); (struct batadv_hard_iface *)( (char *)__mptr - __builtin_offsetof(struct batadv_hard_iface,batman_adv_ptype) );}) ; skb = skb_share_check(skb, ((( gfp_t)0x20u))); if (skb) skb_reset_mac_len(skb);
if (!skb) goto err_out;
As you can see, the skb = skb_share_check() statement stays at it is, and the reset_mac_len() is done afterwards.
Cheers, Simon