linux/drivers/misc
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
..
altera-stapl
c2port drivers/misc/c2port/c2port-duramar2150.c: checking for NULL instead of IS_ERR() 2017-05-08 17:15:10 -07:00
cb710
cxl cxl: Avoid double free_irq() for psl,slice interrupts 2017-06-09 11:30:53 +02:00
echo
eeprom eeprom: idt_89hpesx: Add OF device ID table 2017-04-08 18:22:59 +02:00
genwqe sched/headers: Prepare for new header dependencies before moving code to <linux/sched/signal.h> 2017-03-02 08:42:29 +01:00
ibmasm sched/headers: Prepare to move signal wakeup & sigpending methods from <linux/sched.h> into <linux/sched/signal.h> 2017-03-02 08:42:32 +01:00
lis3lv02d sched/headers: Prepare to move signal wakeup & sigpending methods from <linux/sched.h> into <linux/sched/signal.h> 2017-03-02 08:42:32 +01:00
mei mei: make sysfs modalias format similar as uevent modalias 2017-06-03 19:10:22 +09:00
mic virtio: add context flag to find vqs 2017-05-02 23:41:43 +03:00
sgi-gru mm: convert generic code to 5-level paging 2017-03-09 11:48:47 -08:00
sgi-xp sgi-xp: Use designated initializers 2017-05-28 10:22:42 -07:00
ti-st networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
vmw_vmci drivers/misc/vmw_vmci/vmci_queue_pair.c: fix a couple integer overflow tests 2017-05-08 17:15:10 -07:00
Kconfig misc: pci_endpoint_test: select CRC32 2017-05-16 23:05:40 +02:00
Makefile pci-v4.12-changes 2017-05-08 19:03:25 -07:00
ad525x_dpot-i2c.c
ad525x_dpot-spi.c
ad525x_dpot.c
ad525x_dpot.h
apds990x.c
apds9802als.c
aspeed-lpc-ctrl.c drivers/misc: aspeed-lpc-ctrl: fix printk format warning again 2017-04-08 17:37:20 +02:00
atmel-ssc.c
atmel_tclib.c
bh1770glc.c
cs5535-mfgpt.c
ds1682.c misc: ds1682: Add OF device ID table 2017-04-08 18:22:59 +02:00
dummy-irq.c Annotate hardware config module parameters in drivers/misc/ 2017-04-20 12:02:32 +01:00
enclosure.c scsi: ses: don't get power status of SES device slot on probe 2017-04-06 12:48:05 -04:00
fsa9480.c
hmc6352.c
hpilo.c
hpilo.h
ics932s401.c
ioc4.c
isl29003.c
isl29020.c
kgdbts.c sched/headers: Prepare for new header dependencies before moving code to <linux/sched/task.h> 2017-03-02 08:42:35 +01:00
lattice-ecp3-config.c
lkdtm.h lkdtm: add bad USER_DS test 2017-04-08 17:56:02 +02:00
lkdtm_bugs.c misc: lkdtm: Add volatile to intentional NULL pointer reference 2017-04-18 18:03:42 +02:00
lkdtm_core.c lkdtm: add bad USER_DS test 2017-04-08 17:56:02 +02:00
lkdtm_heap.c sched/headers: Prepare to remove <linux/cred.h> inclusion from <linux/sched.h> 2017-03-02 08:42:31 +01:00
lkdtm_perms.c
lkdtm_rodata.c
lkdtm_usercopy.c sched/headers: Prepare for new header dependencies before moving code to <linux/sched/task_stack.h> 2017-03-02 08:42:36 +01:00
pch_phub.c
pci_endpoint_test.c misc: Add host side PCI driver for PCI test function device 2017-04-28 10:23:19 -05:00
phantom.c
pti.c
qcom-coincell.c
spear13xx_pcie_gadget.c
sram-exec.c drivers/misc/sram-exec.c: use set_memory.h header 2017-05-08 17:15:14 -07:00
sram.c
sram.h
ti_dac7512.c
tifm_7xx1.c
tifm_core.c
tsl2550.c misc: tsl2550: Add OF device ID table 2017-04-08 18:22:59 +02:00
vexpress-syscfg.c sched/headers: Prepare to move signal wakeup & sigpending methods from <linux/sched.h> into <linux/sched/signal.h> 2017-03-02 08:42:32 +01:00
vmw_balloon.c