linux/net/bluetooth
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
..
bnep net: introduce __skb_put_[zero, data, u8] 2017-06-20 13:30:14 -04:00
cmtp networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
hidp networking: add and use skb_put_u8() 2017-06-16 11:48:40 -04:00
rfcomm networking: make skb_push & __skb_push return void pointers 2017-06-16 11:48:40 -04:00
6lowpan.c net: Fix inconsistent teardown and release of private netdev state. 2017-06-07 15:53:24 -04:00
a2mp.c networking: make skb_pull & friends return void pointers 2017-06-16 11:48:39 -04:00
a2mp.h
af_bluetooth.c net: socket: mark socket protocol handler structs as const 2017-05-16 11:54:07 -04:00
amp.c Bluetooth: fix assignments on error variable err 2017-04-12 22:02:38 +02:00
amp.h
ecdh_helper.c Bluetooth: Delete error messages for failed memory allocations in two functions 2017-05-22 10:23:41 +02:00
ecdh_helper.h Bluetooth: convert smp and selftest to crypto kpp API 2017-04-25 04:53:42 +02:00
hci_conn.c
hci_core.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
hci_debugfs.c
hci_debugfs.h
hci_event.c
hci_request.c networking: make skb_put & friends return void pointers 2017-06-16 11:48:39 -04:00
hci_request.h
hci_sock.c networking: add and use skb_put_u8() 2017-06-16 11:48:40 -04:00
hci_sysfs.c
Kconfig Bluetooth: convert smp and selftest to crypto kpp API 2017-04-25 04:53:42 +02:00
l2cap_core.c networking: make skb_put & friends return void pointers 2017-06-16 11:48:39 -04:00
l2cap_sock.c
leds.c
leds.h
lib.c
Makefile Bluetooth: convert smp and selftest to crypto kpp API 2017-04-25 04:53:42 +02:00
mgmt.c
mgmt_util.c networking: make skb_push & __skb_push return void pointers 2017-06-16 11:48:40 -04:00
mgmt_util.h
sco.c
selftest.c Bluetooth: allocate data for kpp on heap 2017-04-30 12:22:05 +02:00
selftest.h
smp.c Bluetooth: use constant time memory comparison for secret values 2017-06-10 15:45:40 +02:00
smp.h