linux-stable/net/802
yuan linyu de77b966ce net: introduce __skb_put_[zero, data, u8]
follow Johannes Berg, semantic patch file as below,
@@
identifier p, p2;
expression len;
expression skb;
type t, t2;
@@
(
-p = __skb_put(skb, len);
+p = __skb_put_zero(skb, len);
|
-p = (t)__skb_put(skb, len);
+p = __skb_put_zero(skb, len);
)
... when != p
(
p2 = (t2)p;
-memset(p2, 0, len);
|
-memset(p, 0, len);
)

@@
identifier p;
expression len;
expression skb;
type t;
@@
(
-t p = __skb_put(skb, len);
+t p = __skb_put_zero(skb, len);
)
... when != p
(
-memset(p, 0, len);
)

@@
type t, t2;
identifier p, p2;
expression skb;
@@
t *p;
...
(
-p = __skb_put(skb, sizeof(t));
+p = __skb_put_zero(skb, sizeof(t));
|
-p = (t *)__skb_put(skb, sizeof(t));
+p = __skb_put_zero(skb, sizeof(t));
)
... when != p
(
p2 = (t2)p;
-memset(p2, 0, sizeof(*p));
|
-memset(p, 0, sizeof(*p));
)

@@
expression skb, len;
@@
-memset(__skb_put(skb, len), 0, len);
+__skb_put_zero(skb, len);

@@
expression skb, len, data;
@@
-memcpy(__skb_put(skb, len), data, len);
+__skb_put_data(skb, data, len);

@@
expression SKB, C, S;
typedef u8;
identifier fn = {__skb_put};
fresh identifier fn2 = fn ## "_u8";
@@
- *(u8 *)fn(SKB, S) = C;
+ fn2(SKB, C);

Signed-off-by: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-20 13:30:14 -04:00
..
fc.c networking: make skb_push & __skb_push return void pointers 2017-06-16 11:48:40 -04:00
fddi.c networking: make skb_push & __skb_push return void pointers 2017-06-16 11:48:40 -04:00
garp.c net: introduce __skb_put_[zero, data, u8] 2017-06-20 13:30:14 -04:00
hippi.c networking: make skb_push & __skb_push return void pointers 2017-06-16 11:48:40 -04:00
Kconfig net/802: Implement Multiple Registration Protocol (MRP) 2013-02-10 20:37:22 -05:00
Makefile net/802: Implement Multiple Registration Protocol (MRP) 2013-02-10 20:37:22 -05:00
mrp.c networking: make skb_put & friends return void pointers 2017-06-16 11:48:39 -04:00
p8022.c net: delete all instances of special processing for token ring 2012-05-15 20:14:35 -04:00
p8023.c
psnap.c snap: remove one synchronize_net() 2011-05-23 16:29:24 -04:00
stp.c 802: Convert compare_ether_addr to ether_addr_equal 2012-05-09 20:49:17 -04:00