Ubuntu-focal-kernel/drivers/net
Johannes Berg 59ae1d127a networking: introduce and use skb_put_data()
A common pattern with skb_put() is to just want to memcpy()
some data into the new space, introduce skb_put_data() for
this.

An spatch similar to the one for skb_put_zero() converts many
of the places using it:

    @@
    identifier p, p2;
    expression len, skb, data;
    type t, t2;
    @@
    (
    -p = skb_put(skb, len);
    +p = skb_put_data(skb, data, len);
    |
    -p = (t)skb_put(skb, len);
    +p = skb_put_data(skb, data, len);
    )
    (
    p2 = (t2)p;
    -memcpy(p2, data, len);
    |
    -memcpy(p, data, len);
    )

    @@
    type t, t2;
    identifier p, p2;
    expression skb, data;
    @@
    t *p;
    ...
    (
    -p = skb_put(skb, sizeof(t));
    +p = skb_put_data(skb, data, sizeof(t));
    |
    -p = (t *)skb_put(skb, sizeof(t));
    +p = skb_put_data(skb, data, sizeof(t));
    )
    (
    p2 = (t2)p;
    -memcpy(p2, data, sizeof(*p));
    |
    -memcpy(p, data, sizeof(*p));
    )

    @@
    expression skb, len, data;
    @@
    -memcpy(skb_put(skb, len), data, len);
    +skb_put_data(skb, data, len);

(again, manually post-processed to retain some comments)

Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-16 11:48:37 -04:00
..
appletalk
arcnet
bonding networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
caif networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
can networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
cris
dsa net: dsa: mv88e6xxx: prefix Global Prio and Tag macros 2017-06-15 14:07:50 -04:00
ethernet networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
fddi
fjes networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
hamradio networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
hippi networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
hyperv networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
ieee802154 networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
ipvlan Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-06-15 11:59:32 -04:00
irda networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
phy Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-06-15 11:59:32 -04:00
plip
ppp networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
slip networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
team Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-06-15 11:59:32 -04:00
usb networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
vmxnet3
wan networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
wimax networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
wireless networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
xen-netback
Kconfig
LICENSE.SRC
Makefile
Space.c
dummy.c
eql.c
geneve.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-06-15 11:59:32 -04:00
gtp.c
ifb.c
loopback.c
macsec.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-06-15 11:59:32 -04:00
macvlan.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-06-15 11:59:32 -04:00
macvtap.c
mdio.c
mii.c
netconsole.c netconsole: Remove duplicate "netconsole: " logging prefix 2017-06-13 12:57:40 -04:00
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
sungem_phy.c
tap.c
tun.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-06-15 11:59:32 -04:00
veth.c
virtio_net.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
vrf.c
vsockmon.c
vxlan.c networking: convert many more places to skb_put_zero() 2017-06-16 11:48:35 -04:00
xen-netfront.c