kernel_optimize_test/drivers
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
..
accessibility
acpi Merge branch 'acpica-fixes' 2017-06-15 01:52:32 +02:00
amba
android
ata libata: fix error checking in in ata_parse_force_one() 2017-05-31 14:26:26 -04:00
atm networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
auxdisplay
base Merge branches 'intel_pstate' and 'pm-sleep' 2017-06-09 01:25:16 +02:00
bcma
block Fix loop device flush before configure v3 2017-06-08 08:04:18 -06:00
bluetooth networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
bus
cdrom
char networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
clk Sort of on the quieter side this time, which is probably due more 2017-05-10 13:38:18 -07:00
clocksource Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-05-12 10:43:25 -07:00
connector
cpufreq Merge branches 'pm-cpufreq', 'pm-cpuidle' and 'pm-devfreq' 2017-06-15 01:51:33 +02:00
cpuidle Merge branches 'pm-cpufreq', 'pm-cpuidle' and 'pm-devfreq' 2017-06-15 01:51:33 +02:00
crypto
dax device-dax: fix 'dax' device filesystem inode destruction crash 2017-06-09 08:50:49 -07:00
dca
devfreq PM / devfreq: exynos-ppmu: Staticize event list 2017-06-12 10:12:07 +09:00
dio
dma dmaengine: pl330: fix warning in pl330_remove 2017-06-02 11:49:44 +05:30
dma-buf
edac
eisa
extcon
firewire networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
firmware Char/Misc driver fixes for 4.12-rc5 2017-06-11 11:29:15 -07:00
fmc
fpga
fsi
gpio gpio: mvebu: fix gpio bank registration when pwm is used 2017-06-09 09:38:27 +02:00
gpu Merge branch 'vmwgfx-fixes-4.12' of git://people.freedesktop.org/~thomash/linux into drm-fixes 2017-06-09 13:12:02 +10:00
hid HID: let generic driver yield control iff specific driver has been enabled 2017-06-13 16:52:50 +02:00
hsi hsi: Fix build regression due to netdev destructor fix. 2017-06-08 10:16:05 -04:00
hv
hwmon hwmon: (aspeed-pwm-tacho) make fan/pwm names start with index 1 2017-06-03 03:55:43 -07:00
hwspinlock
hwtracing
i2c i2c: designware: Fix bogus sda_hold_time due to uninitialized vars 2017-05-22 19:22:19 -07:00
ide
idle
iio First set of IIO fixes in the 4.12 cycle. 2017-05-22 21:53:09 +02:00
infiniband networking: convert many more places to skb_put_zero() 2017-06-16 11:48:35 -04:00
input Input: synaptics-rmi4 - register F03 port as pass-through serio 2017-06-09 09:57:19 -07:00
iommu iommu/of: Ignore all errors except EPROBE_DEFER 2017-05-30 11:31:32 +02:00
ipack
irqchip Xtensa fixes for v4.12-rc6 2017-06-13 15:09:10 +09:00
isdn networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
leds leds: pca955x: Correct I2C Functionality 2017-05-22 21:12:44 +02:00
lguest
lightnvm
macintosh
mailbox
mcb
md md: initialise ->writes_pending in personality modules. 2017-06-05 16:04:35 -07:00
media networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
memory Merge tag 'at91-4.12-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux into fixes 2017-06-01 17:07:31 -07:00
memstick
message
mfd
misc networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
mmc This pull request contains fixes to make the WiFi work again for the ARM64 2017-05-26 09:05:35 -07:00
mtd mtd: nand: make nand_ooblayout_lp_hamming_ops static 2017-05-22 09:42:29 +02:00
net networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
nfc networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
ntb
nubus
nvdimm Merge branch 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm 2017-05-12 15:43:10 -07:00
nvme nvme: relax APST default max latency to 100ms 2017-06-07 11:08:55 +02:00
nvmem
of Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-06-15 11:59:32 -04:00
oprofile
parisc
parport
pci PCI/PM: Add needs_resume flag to avoid suspend complete optimization 2017-05-23 14:18:17 -05:00
pcmcia Annotation of module parameters that specify device settings 2017-05-10 19:13:03 -07:00
perf drivers/perf: arm_pmu_acpi: avoid perf IRQ init when guest PMU is off 2017-05-30 12:40:03 +01:00
phy phy: qualcomm: phy-qcom-qmp: fix application of sizeof to pointer 2017-06-01 15:03:41 +05:30
pinctrl pinctrl: sunxi: Fix SPDIF function name for A83T 2017-05-23 11:31:27 +02:00
platform goldfish_pipe: use GFP_ATOMIC under spin lock 2017-05-25 18:26:11 +02:00
pnp
power power supply and reset changes for the v4.12 series (part 2) 2017-05-12 12:02:21 -07:00
powercap PowerCap: Fix an error code in powercap_register_zone() 2017-05-14 13:30:05 +02:00
pps
ps3
ptp ptp: Add a ptp clock driver for Broadcom DTE 2017-06-15 12:07:15 -04:00
pwm
rapidio
ras
regulator
remoteproc
reset reset: hi6220: Set module license so that it can be loaded 2017-05-24 10:53:41 +02:00
rpmsg networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
rtc Merge branches 'pm-sleep' and 'powercap' 2017-05-22 20:32:05 +02:00
s390 networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
sbus
scsi networking: convert many more places to skb_put_zero() 2017-06-16 11:48:35 -04:00
sfi
sh
sn
soc ARM: SoC fixes (and a cross-arch dt-include fix) 2017-05-19 13:36:56 -07:00
spi
spmi
ssb ssb: Delete an error message for a failed memory allocation in ssb_devices_register() 2017-05-24 16:46:51 +03:00
staging networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
target cxgb4: Fix tids count for ipv6 offload connection 2017-06-07 15:14:34 -04:00
tc
tee Linux 4.12-rc1 2017-05-18 23:54:47 -07:00
thermal thermal: broadcom: ns-thermal: default on iProc SoCs 2017-05-23 20:09:34 -07:00
thunderbolt
tty networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
uio uio: fix incorrect memory leak cleanup 2017-05-16 23:06:41 +02:00
usb networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
uwb uwb: fix device quirk on big-endian hosts 2017-05-17 11:27:41 +02:00
vfio
vhost vhost_net: try batch dequing from skb array 2017-05-18 10:07:42 -04:00
video fbdev changes for v4.12: 2017-05-11 11:12:26 -07:00
virt
virtio
vlynq
vme
w1
watchdog watchdog: bcm281xx: Fix use of uninitialized spinlock. 2017-05-19 10:42:25 +02:00
xen xen: fix for 4.12 rc5 2017-06-09 09:59:51 -07:00
zorro
Kconfig
Makefile Merge branch 'tee/initial-merge' into fixes 2017-05-10 21:03:31 +02:00