]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
net: introduce __skb_put_[zero, data, u8]
authoryuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
Sun, 18 Jun 2017 14:48:17 +0000 (22:48 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 20 Jun 2017 17:30:14 +0000 (13:30 -0400)
commitde77b966ce8adcb4c58d50e2f087320d5479812a
treeb18e9a0dc3694a7d7165ec8631801d6ba47de15f
parentddcbabf4404606fcc3edf6e48caa9707b33d3df4
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>
19 files changed:
drivers/crypto/chelsio/chcr_algo.c
drivers/infiniband/hw/cxgb4/cm.c
drivers/infiniband/hw/cxgb4/cq.c
drivers/infiniband/hw/cxgb4/mem.c
drivers/infiniband/hw/cxgb4/qp.c
drivers/isdn/gigaset/asyncdata.c
drivers/isdn/gigaset/isocdata.c
drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
drivers/net/ethernet/chelsio/cxgb3/sge.c
drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c
drivers/net/usb/int51x1.c
drivers/staging/octeon/ethernet-tx.c
drivers/target/iscsi/cxgbit/cxgbit_cm.c
include/linux/skbuff.h
lib/test_bpf.c
net/802/garp.c
net/bluetooth/bnep/core.c
net/bluetooth/bnep/netdev.c
net/bridge/br_stp_bpdu.c