diff options
author | Arnaldo Carvalho de Melo <acme@ghostprotocols.net> | 2007-03-31 10:55:19 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:28:29 -0400 |
commit | 27d7ff46a3498d3debc6ba68fb8014c702b81170 (patch) | |
tree | b5a0c617cf8339524d3b1f1633e08eae7b94cf86 | |
parent | 3dbad80ac7632f243b824d469301abb97ec634a1 (diff) |
[SK_BUFF]: Introduce skb_copy_to_linear_data{_offset}
To clearly state the intent of copying to linear sk_buffs, _offset being a
overly long variant but interesting for the sake of saving some bytes.
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
63 files changed, 185 insertions, 127 deletions
diff --git a/arch/ia64/hp/sim/simeth.c b/arch/ia64/hp/sim/simeth.c index edef008c2b42..f26077a773d5 100644 --- a/arch/ia64/hp/sim/simeth.c +++ b/arch/ia64/hp/sim/simeth.c | |||
@@ -473,7 +473,7 @@ simeth_rx(struct net_device *dev) | |||
473 | * XXX Fix me | 473 | * XXX Fix me |
474 | * Should really do a csum+copy here | 474 | * Should really do a csum+copy here |
475 | */ | 475 | */ |
476 | memcpy(skb->data, frame, len); | 476 | skb_copy_to_linear_data(skb, frame, len); |
477 | #endif | 477 | #endif |
478 | skb->protocol = eth_type_trans(skb, dev); | 478 | skb->protocol = eth_type_trans(skb, dev); |
479 | 479 | ||
diff --git a/arch/ia64/sn/kernel/xpnet.c b/arch/ia64/sn/kernel/xpnet.c index 9fc02654f0f5..5419acb89a8c 100644 --- a/arch/ia64/sn/kernel/xpnet.c +++ b/arch/ia64/sn/kernel/xpnet.c | |||
@@ -233,7 +233,7 @@ xpnet_receive(partid_t partid, int channel, struct xpnet_message *msg) | |||
233 | "%lu)\n", skb->data, &msg->data, | 233 | "%lu)\n", skb->data, &msg->data, |
234 | (size_t) msg->embedded_bytes); | 234 | (size_t) msg->embedded_bytes); |
235 | 235 | ||
236 | memcpy(skb->data, &msg->data, (size_t) msg->embedded_bytes); | 236 | skb_copy_to_linear_data(skb, &msg->data, (size_t)msg->embedded_bytes); |
237 | } else { | 237 | } else { |
238 | dev_dbg(xpnet, "transferring buffer to the skb->data area;\n\t" | 238 | dev_dbg(xpnet, "transferring buffer to the skb->data area;\n\t" |
239 | "bte_copy(0x%p, 0x%p, %hu)\n", (void *)msg->buf_pa, | 239 | "bte_copy(0x%p, 0x%p, %hu)\n", (void *)msg->buf_pa, |
diff --git a/drivers/isdn/hysdn/hycapi.c b/drivers/isdn/hysdn/hycapi.c index 4433ce0fca55..f85450146bdc 100644 --- a/drivers/isdn/hysdn/hycapi.c +++ b/drivers/isdn/hysdn/hycapi.c | |||
@@ -399,7 +399,8 @@ static u16 hycapi_send_message(struct capi_ctr *ctrl, struct sk_buff *skb) | |||
399 | if (_len > 22) { | 399 | if (_len > 22) { |
400 | _len2 = _len - 22; | 400 | _len2 = _len - 22; |
401 | skb_copy_from_linear_data(skb, msghead, 22); | 401 | skb_copy_from_linear_data(skb, msghead, 22); |
402 | memcpy(skb->data + _len2, msghead, 22); | 402 | skb_copy_to_linear_data_offset(skb, _len2, |
403 | msghead, 22); | ||
403 | skb_pull(skb, _len2); | 404 | skb_pull(skb, _len2); |
404 | CAPIMSG_SETLEN(skb->data, 22); | 405 | CAPIMSG_SETLEN(skb->data, 22); |
405 | retval = capilib_data_b3_req(&cinfo->ncci_head, | 406 | retval = capilib_data_b3_req(&cinfo->ncci_head, |
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c index 2101334a8ac2..a844b1fe2dc4 100644 --- a/drivers/net/8139too.c +++ b/drivers/net/8139too.c | |||
@@ -1904,10 +1904,10 @@ static __inline__ void wrap_copy(struct sk_buff *skb, const unsigned char *ring, | |||
1904 | u32 left = RX_BUF_LEN - offset; | 1904 | u32 left = RX_BUF_LEN - offset; |
1905 | 1905 | ||
1906 | if (size > left) { | 1906 | if (size > left) { |
1907 | memcpy(skb->data, ring + offset, left); | 1907 | skb_copy_to_linear_data(skb, ring + offset, left); |
1908 | memcpy(skb->data+left, ring, size - left); | 1908 | skb_copy_to_linear_data_offset(skb, left, ring, size - left); |
1909 | } else | 1909 | } else |
1910 | memcpy(skb->data, ring + offset, size); | 1910 | skb_copy_to_linear_data(skb, ring + offset, size); |
1911 | } | 1911 | } |
1912 | #endif | 1912 | #endif |
1913 | 1913 | ||
diff --git a/drivers/net/appletalk/ltpc.c b/drivers/net/appletalk/ltpc.c index 43c17c85c97b..6a6cbd331a16 100644 --- a/drivers/net/appletalk/ltpc.c +++ b/drivers/net/appletalk/ltpc.c | |||
@@ -774,7 +774,7 @@ static int sendup_buffer (struct net_device *dev) | |||
774 | skb_pull(skb,3); | 774 | skb_pull(skb,3); |
775 | 775 | ||
776 | /* copy ddp(s,e)hdr + contents */ | 776 | /* copy ddp(s,e)hdr + contents */ |
777 | memcpy(skb->data,(void*)ltdmabuf,len); | 777 | skb_copy_to_linear_data(skb, ltdmabuf, len); |
778 | 778 | ||
779 | skb_reset_transport_header(skb); | 779 | skb_reset_transport_header(skb); |
780 | 780 | ||
diff --git a/drivers/net/atari_bionet.c b/drivers/net/atari_bionet.c index 13dbed368d6a..3d87bd2b4194 100644 --- a/drivers/net/atari_bionet.c +++ b/drivers/net/atari_bionet.c | |||
@@ -550,7 +550,8 @@ bionet_poll_rx(struct net_device *dev) { | |||
550 | 550 | ||
551 | /* 'skb->data' points to the start of sk_buff data area. | 551 | /* 'skb->data' points to the start of sk_buff data area. |
552 | */ | 552 | */ |
553 | memcpy(skb->data, nic_packet->buffer, pkt_len); | 553 | skb_copy_to_linear_data(skb, nic_packet->buffer, |
554 | pkt_len); | ||
554 | skb->protocol = eth_type_trans( skb, dev ); | 555 | skb->protocol = eth_type_trans( skb, dev ); |
555 | netif_rx(skb); | 556 | netif_rx(skb); |
556 | dev->last_rx = jiffies; | 557 | dev->last_rx = jiffies; |
diff --git a/drivers/net/atari_pamsnet.c b/drivers/net/atari_pamsnet.c index 745101d7451b..54714409a09b 100644 --- a/drivers/net/atari_pamsnet.c +++ b/drivers/net/atari_pamsnet.c | |||
@@ -793,7 +793,8 @@ pamsnet_poll_rx(struct net_device *dev) { | |||
793 | 793 | ||
794 | /* 'skb->data' points to the start of sk_buff data area. | 794 | /* 'skb->data' points to the start of sk_buff data area. |
795 | */ | 795 | */ |
796 | memcpy(skb->data, nic_packet->buffer, pkt_len); | 796 | skb_copy_to_linear_data(skb, nic_packet->buffer, |
797 | pkt_len); | ||
797 | netif_rx(skb); | 798 | netif_rx(skb); |
798 | dev->last_rx = jiffies; | 799 | dev->last_rx = jiffies; |
799 | lp->stats.rx_packets++; | 800 | lp->stats.rx_packets++; |
diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c index 1be1bbd16164..e4f874a70fe5 100644 --- a/drivers/net/chelsio/sge.c +++ b/drivers/net/chelsio/sge.c | |||
@@ -2095,10 +2095,14 @@ static void espibug_workaround_t204(unsigned long data) | |||
2095 | 0x0, 0x7, 0x43, 0x0, 0x0, 0x0 | 2095 | 0x0, 0x7, 0x43, 0x0, 0x0, 0x0 |
2096 | }; | 2096 | }; |
2097 | 2097 | ||
2098 | memcpy(skb->data + sizeof(struct cpl_tx_pkt), | 2098 | skb_copy_to_linear_data_offset(skb, |
2099 | ch_mac_addr, ETH_ALEN); | 2099 | sizeof(struct cpl_tx_pkt), |
2100 | memcpy(skb->data + skb->len - 10, | 2100 | ch_mac_addr, |
2101 | ch_mac_addr, ETH_ALEN); | 2101 | ETH_ALEN); |
2102 | skb_copy_to_linear_data_offset(skb, | ||
2103 | skb->len - 10, | ||
2104 | ch_mac_addr, | ||
2105 | ETH_ALEN); | ||
2102 | skb->cb[0] = 0xff; | 2106 | skb->cb[0] = 0xff; |
2103 | } | 2107 | } |
2104 | 2108 | ||
@@ -2125,10 +2129,14 @@ static void espibug_workaround(unsigned long data) | |||
2125 | if (!skb->cb[0]) { | 2129 | if (!skb->cb[0]) { |
2126 | u8 ch_mac_addr[ETH_ALEN] = | 2130 | u8 ch_mac_addr[ETH_ALEN] = |
2127 | {0x0, 0x7, 0x43, 0x0, 0x0, 0x0}; | 2131 | {0x0, 0x7, 0x43, 0x0, 0x0, 0x0}; |
2128 | memcpy(skb->data + sizeof(struct cpl_tx_pkt), | 2132 | skb_copy_to_linear_data_offset(skb, |
2129 | ch_mac_addr, ETH_ALEN); | 2133 | sizeof(struct cpl_tx_pkt), |
2130 | memcpy(skb->data + skb->len - 10, ch_mac_addr, | 2134 | ch_mac_addr, |
2131 | ETH_ALEN); | 2135 | ETH_ALEN); |
2136 | skb_copy_to_linear_data_offset(skb, | ||
2137 | skb->len - 10, | ||
2138 | ch_mac_addr, | ||
2139 | ETH_ALEN); | ||
2132 | skb->cb[0] = 0xff; | 2140 | skb->cb[0] = 0xff; |
2133 | } | 2141 | } |
2134 | 2142 | ||
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c index 166c959c94b9..3666586a4831 100644 --- a/drivers/net/cxgb3/sge.c +++ b/drivers/net/cxgb3/sge.c | |||
@@ -661,7 +661,7 @@ static inline struct sk_buff *get_imm_packet(const struct rsp_desc *resp) | |||
661 | 661 | ||
662 | if (skb) { | 662 | if (skb) { |
663 | __skb_put(skb, IMMED_PKT_SIZE); | 663 | __skb_put(skb, IMMED_PKT_SIZE); |
664 | memcpy(skb->data, resp->imm_data, IMMED_PKT_SIZE); | 664 | skb_copy_to_linear_data(skb, resp->imm_data, IMMED_PKT_SIZE); |
665 | } | 665 | } |
666 | return skb; | 666 | return skb; |
667 | } | 667 | } |
@@ -1722,11 +1722,11 @@ static void skb_data_init(struct sk_buff *skb, struct sge_fl_page *p, | |||
1722 | { | 1722 | { |
1723 | skb->len = len; | 1723 | skb->len = len; |
1724 | if (len <= SKB_DATA_SIZE) { | 1724 | if (len <= SKB_DATA_SIZE) { |
1725 | memcpy(skb->data, p->va, len); | 1725 | skb_copy_to_linear_data(skb, p->va, len); |
1726 | skb->tail += len; | 1726 | skb->tail += len; |
1727 | put_page(p->frag.page); | 1727 | put_page(p->frag.page); |
1728 | } else { | 1728 | } else { |
1729 | memcpy(skb->data, p->va, SKB_DATA_SIZE); | 1729 | skb_copy_to_linear_data(skb, p->va, SKB_DATA_SIZE); |
1730 | skb_shinfo(skb)->frags[0].page = p->frag.page; | 1730 | skb_shinfo(skb)->frags[0].page = p->frag.page; |
1731 | skb_shinfo(skb)->frags[0].page_offset = | 1731 | skb_shinfo(skb)->frags[0].page_offset = |
1732 | p->frag.page_offset + SKB_DATA_SIZE; | 1732 | p->frag.page_offset + SKB_DATA_SIZE; |
diff --git a/drivers/net/defxx.c b/drivers/net/defxx.c index 8d29fae1c71c..571d82f8008c 100644 --- a/drivers/net/defxx.c +++ b/drivers/net/defxx.c | |||
@@ -3091,7 +3091,9 @@ static void dfx_rcv_queue_process( | |||
3091 | { | 3091 | { |
3092 | /* Receive buffer allocated, pass receive packet up */ | 3092 | /* Receive buffer allocated, pass receive packet up */ |
3093 | 3093 | ||
3094 | memcpy(skb->data, p_buff + RCV_BUFF_K_PADDING, pkt_len+3); | 3094 | skb_copy_to_linear_data(skb, |
3095 | p_buff + RCV_BUFF_K_PADDING, | ||
3096 | pkt_len + 3); | ||
3095 | } | 3097 | } |
3096 | 3098 | ||
3097 | skb_reserve(skb,3); /* adjust data field so that it points to FC byte */ | 3099 | skb_reserve(skb,3); /* adjust data field so that it points to FC byte */ |
diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 0cefef5e3f06..4d0e0aea72bf 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c | |||
@@ -1769,7 +1769,7 @@ static int e100_rx_alloc_skb(struct nic *nic, struct rx *rx) | |||
1769 | 1769 | ||
1770 | /* Align, init, and map the RFD. */ | 1770 | /* Align, init, and map the RFD. */ |
1771 | skb_reserve(rx->skb, NET_IP_ALIGN); | 1771 | skb_reserve(rx->skb, NET_IP_ALIGN); |
1772 | memcpy(rx->skb->data, &nic->blank_rfd, sizeof(struct rfd)); | 1772 | skb_copy_to_linear_data(rx->skb, &nic->blank_rfd, sizeof(struct rfd)); |
1773 | rx->dma_addr = pci_map_single(nic->pdev, rx->skb->data, | 1773 | rx->dma_addr = pci_map_single(nic->pdev, rx->skb->data, |
1774 | RFD_BUF_LEN, PCI_DMA_BIDIRECTIONAL); | 1774 | RFD_BUF_LEN, PCI_DMA_BIDIRECTIONAL); |
1775 | 1775 | ||
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index e7c93f44f810..610216ec4918 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -4224,9 +4224,12 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter, | |||
4224 | netdev_alloc_skb(netdev, length + NET_IP_ALIGN); | 4224 | netdev_alloc_skb(netdev, length + NET_IP_ALIGN); |
4225 | if (new_skb) { | 4225 | if (new_skb) { |
4226 | skb_reserve(new_skb, NET_IP_ALIGN); | 4226 | skb_reserve(new_skb, NET_IP_ALIGN); |
4227 | memcpy(new_skb->data - NET_IP_ALIGN, | 4227 | skb_copy_to_linear_data_offset(new_skb, |
4228 | skb->data - NET_IP_ALIGN, | 4228 | -NET_IP_ALIGN, |
4229 | length + NET_IP_ALIGN); | 4229 | (skb->data - |
4230 | NET_IP_ALIGN), | ||
4231 | (length + | ||
4232 | NET_IP_ALIGN)); | ||
4230 | /* save the skb in buffer_info as good */ | 4233 | /* save the skb in buffer_info as good */ |
4231 | buffer_info->skb = skb; | 4234 | buffer_info->skb = skb; |
4232 | skb = new_skb; | 4235 | skb = new_skb; |
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index 8b5392072632..58364a0ff378 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -391,8 +391,8 @@ static int ehea_poll(struct net_device *dev, int *budget) | |||
391 | if (!skb) | 391 | if (!skb) |
392 | break; | 392 | break; |
393 | } | 393 | } |
394 | memcpy(skb->data, ((char*)cqe) + 64, | 394 | skb_copy_to_linear_data(skb, ((char*)cqe) + 64, |
395 | cqe->num_bytes_transfered - 4); | 395 | cqe->num_bytes_transfered - 4); |
396 | ehea_fill_skb(dev, skb, cqe); | 396 | ehea_fill_skb(dev, skb, cqe); |
397 | } else if (rq == 2) { /* RQ2 */ | 397 | } else if (rq == 2) { /* RQ2 */ |
398 | skb = get_skb_by_index(skb_arr_rq2, | 398 | skb = get_skb_by_index(skb_arr_rq2, |
diff --git a/drivers/net/irda/ali-ircc.c b/drivers/net/irda/ali-ircc.c index fb2248a25516..f9c889c0dd07 100644 --- a/drivers/net/irda/ali-ircc.c +++ b/drivers/net/irda/ali-ircc.c | |||
@@ -1923,7 +1923,7 @@ static int ali_ircc_dma_receive_complete(struct ali_ircc_cb *self) | |||
1923 | 1923 | ||
1924 | /* Copy frame without CRC, CRC is removed by hardware*/ | 1924 | /* Copy frame without CRC, CRC is removed by hardware*/ |
1925 | skb_put(skb, len); | 1925 | skb_put(skb, len); |
1926 | memcpy(skb->data, self->rx_buff.data, len); | 1926 | skb_copy_to_linear_data(skb, self->rx_buff.data, len); |
1927 | 1927 | ||
1928 | /* Move to next frame */ | 1928 | /* Move to next frame */ |
1929 | self->rx_buff.data += len; | 1929 | self->rx_buff.data += len; |
diff --git a/drivers/net/irda/au1k_ir.c b/drivers/net/irda/au1k_ir.c index cdd1f6c1e741..4dbdfaaf37bf 100644 --- a/drivers/net/irda/au1k_ir.c +++ b/drivers/net/irda/au1k_ir.c | |||
@@ -604,7 +604,7 @@ static int au1k_irda_rx(struct net_device *dev) | |||
604 | skb_put(skb, count); | 604 | skb_put(skb, count); |
605 | else | 605 | else |
606 | skb_put(skb, count-2); | 606 | skb_put(skb, count-2); |
607 | memcpy(skb->data, (void *)pDB->vaddr, count-2); | 607 | skb_copy_to_linear_data(skb, pDB->vaddr, count - 2); |
608 | skb->dev = dev; | 608 | skb->dev = dev; |
609 | skb_reset_mac_header(skb); | 609 | skb_reset_mac_header(skb); |
610 | skb->protocol = htons(ETH_P_IRDA); | 610 | skb->protocol = htons(ETH_P_IRDA); |
diff --git a/drivers/net/irda/donauboe.c b/drivers/net/irda/donauboe.c index 9987a0dc1eaf..3ca47bf6dfec 100644 --- a/drivers/net/irda/donauboe.c +++ b/drivers/net/irda/donauboe.c | |||
@@ -1282,8 +1282,8 @@ dumpbufs(self->rx_bufs[self->rxs],len,'<'); | |||
1282 | skb_reserve (skb, 1); | 1282 | skb_reserve (skb, 1); |
1283 | 1283 | ||
1284 | skb_put (skb, len); | 1284 | skb_put (skb, len); |
1285 | memcpy (skb->data, self->rx_bufs[self->rxs], len); | 1285 | skb_copy_to_linear_data(skb, self->rx_bufs[self->rxs], |
1286 | 1286 | len); | |
1287 | self->stats.rx_packets++; | 1287 | self->stats.rx_packets++; |
1288 | skb->dev = self->netdev; | 1288 | skb->dev = self->netdev; |
1289 | skb_reset_mac_header(skb); | 1289 | skb_reset_mac_header(skb); |
diff --git a/drivers/net/irda/mcs7780.c b/drivers/net/irda/mcs7780.c index 4b0037e498f8..54d1d543c92c 100644 --- a/drivers/net/irda/mcs7780.c +++ b/drivers/net/irda/mcs7780.c | |||
@@ -426,7 +426,7 @@ static void mcs_unwrap_mir(struct mcs_cb *mcs, __u8 *buf, int len) | |||
426 | } | 426 | } |
427 | 427 | ||
428 | skb_reserve(skb, 1); | 428 | skb_reserve(skb, 1); |
429 | memcpy(skb->data, buf, new_len); | 429 | skb_copy_to_linear_data(skb, buf, new_len); |
430 | skb_put(skb, new_len); | 430 | skb_put(skb, new_len); |
431 | skb_reset_mac_header(skb); | 431 | skb_reset_mac_header(skb); |
432 | skb->protocol = htons(ETH_P_IRDA); | 432 | skb->protocol = htons(ETH_P_IRDA); |
@@ -479,7 +479,7 @@ static void mcs_unwrap_fir(struct mcs_cb *mcs, __u8 *buf, int len) | |||
479 | } | 479 | } |
480 | 480 | ||
481 | skb_reserve(skb, 1); | 481 | skb_reserve(skb, 1); |
482 | memcpy(skb->data, buf, new_len); | 482 | skb_copy_to_linear_data(skb, buf, new_len); |
483 | skb_put(skb, new_len); | 483 | skb_put(skb, new_len); |
484 | skb_reset_mac_header(skb); | 484 | skb_reset_mac_header(skb); |
485 | skb->protocol = htons(ETH_P_IRDA); | 485 | skb->protocol = htons(ETH_P_IRDA); |
diff --git a/drivers/net/irda/nsc-ircc.c b/drivers/net/irda/nsc-ircc.c index 0ff992714136..d96c89751a71 100644 --- a/drivers/net/irda/nsc-ircc.c +++ b/drivers/net/irda/nsc-ircc.c | |||
@@ -1868,10 +1868,14 @@ static int nsc_ircc_dma_receive_complete(struct nsc_ircc_cb *self, int iobase) | |||
1868 | /* Copy frame without CRC */ | 1868 | /* Copy frame without CRC */ |
1869 | if (self->io.speed < 4000000) { | 1869 | if (self->io.speed < 4000000) { |
1870 | skb_put(skb, len-2); | 1870 | skb_put(skb, len-2); |
1871 | memcpy(skb->data, self->rx_buff.data, len-2); | 1871 | skb_copy_to_linear_data(skb, |
1872 | self->rx_buff.data, | ||
1873 | len - 2); | ||
1872 | } else { | 1874 | } else { |
1873 | skb_put(skb, len-4); | 1875 | skb_put(skb, len-4); |
1874 | memcpy(skb->data, self->rx_buff.data, len-4); | 1876 | skb_copy_to_linear_data(skb, |
1877 | self->rx_buff.data, | ||
1878 | len - 4); | ||
1875 | } | 1879 | } |
1876 | 1880 | ||
1877 | /* Move to next frame */ | 1881 | /* Move to next frame */ |
diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c index b3e1107420af..fb196fd91855 100644 --- a/drivers/net/irda/pxaficp_ir.c +++ b/drivers/net/irda/pxaficp_ir.c | |||
@@ -386,7 +386,7 @@ static void pxa_irda_fir_irq_eif(struct pxa_irda *si, struct net_device *dev, in | |||
386 | 386 | ||
387 | /* Align IP header to 20 bytes */ | 387 | /* Align IP header to 20 bytes */ |
388 | skb_reserve(skb, 1); | 388 | skb_reserve(skb, 1); |
389 | memcpy(skb->data, si->dma_rx_buff, len); | 389 | skb_copy_to_linear_data(skb, si->dma_rx_buff, len); |
390 | skb_put(skb, len); | 390 | skb_put(skb, len); |
391 | 391 | ||
392 | /* Feed it to IrLAP */ | 392 | /* Feed it to IrLAP */ |
diff --git a/drivers/net/irda/stir4200.c b/drivers/net/irda/stir4200.c index aec86a214340..755aa444a4dd 100644 --- a/drivers/net/irda/stir4200.c +++ b/drivers/net/irda/stir4200.c | |||
@@ -348,7 +348,7 @@ static void fir_eof(struct stir_cb *stir) | |||
348 | } | 348 | } |
349 | skb_reserve(nskb, 1); | 349 | skb_reserve(nskb, 1); |
350 | skb = nskb; | 350 | skb = nskb; |
351 | memcpy(nskb->data, rx_buff->data, len); | 351 | skb_copy_to_linear_data(nskb, rx_buff->data, len); |
352 | } else { | 352 | } else { |
353 | nskb = dev_alloc_skb(rx_buff->truesize); | 353 | nskb = dev_alloc_skb(rx_buff->truesize); |
354 | if (unlikely(!nskb)) { | 354 | if (unlikely(!nskb)) { |
diff --git a/drivers/net/irda/via-ircc.c b/drivers/net/irda/via-ircc.c index 45bbd6686151..ff5358574d0a 100644 --- a/drivers/net/irda/via-ircc.c +++ b/drivers/net/irda/via-ircc.c | |||
@@ -1189,7 +1189,7 @@ F01_E */ | |||
1189 | skb_reserve(skb, 1); | 1189 | skb_reserve(skb, 1); |
1190 | skb_put(skb, len - 4); | 1190 | skb_put(skb, len - 4); |
1191 | 1191 | ||
1192 | memcpy(skb->data, self->rx_buff.data, len - 4); | 1192 | skb_copy_to_linear_data(skb, self->rx_buff.data, len - 4); |
1193 | IRDA_DEBUG(2, "%s(): len=%x.rx_buff=%p\n", __FUNCTION__, | 1193 | IRDA_DEBUG(2, "%s(): len=%x.rx_buff=%p\n", __FUNCTION__, |
1194 | len - 4, self->rx_buff.data); | 1194 | len - 4, self->rx_buff.data); |
1195 | 1195 | ||
@@ -1234,7 +1234,7 @@ static int upload_rxdata(struct via_ircc_cb *self, int iobase) | |||
1234 | } | 1234 | } |
1235 | skb_reserve(skb, 1); | 1235 | skb_reserve(skb, 1); |
1236 | skb_put(skb, len - 4 + 1); | 1236 | skb_put(skb, len - 4 + 1); |
1237 | memcpy(skb->data, self->rx_buff.data, len - 4 + 1); | 1237 | skb_copy_to_linear_data(skb, self->rx_buff.data, len - 4 + 1); |
1238 | st_fifo->tail++; | 1238 | st_fifo->tail++; |
1239 | st_fifo->len++; | 1239 | st_fifo->len++; |
1240 | if (st_fifo->tail > MAX_RX_WINDOW) | 1240 | if (st_fifo->tail > MAX_RX_WINDOW) |
@@ -1303,7 +1303,7 @@ static int RxTimerHandler(struct via_ircc_cb *self, int iobase) | |||
1303 | } | 1303 | } |
1304 | skb_reserve(skb, 1); | 1304 | skb_reserve(skb, 1); |
1305 | skb_put(skb, len - 4); | 1305 | skb_put(skb, len - 4); |
1306 | memcpy(skb->data, self->rx_buff.data, len - 4); | 1306 | skb_copy_to_linear_data(skb, self->rx_buff.data, len - 4); |
1307 | 1307 | ||
1308 | IRDA_DEBUG(2, "%s(): len=%x.head=%x\n", __FUNCTION__, | 1308 | IRDA_DEBUG(2, "%s(): len=%x.head=%x\n", __FUNCTION__, |
1309 | len - 4, st_fifo->head); | 1309 | len - 4, st_fifo->head); |
diff --git a/drivers/net/irda/w83977af_ir.c b/drivers/net/irda/w83977af_ir.c index 0d4a68618fc1..5182e800cc18 100644 --- a/drivers/net/irda/w83977af_ir.c +++ b/drivers/net/irda/w83977af_ir.c | |||
@@ -908,10 +908,14 @@ int w83977af_dma_receive_complete(struct w83977af_ir *self) | |||
908 | /* Copy frame without CRC */ | 908 | /* Copy frame without CRC */ |
909 | if (self->io.speed < 4000000) { | 909 | if (self->io.speed < 4000000) { |
910 | skb_put(skb, len-2); | 910 | skb_put(skb, len-2); |
911 | memcpy(skb->data, self->rx_buff.data, len-2); | 911 | skb_copy_to_linear_data(skb, |
912 | self->rx_buff.data, | ||
913 | len - 2); | ||
912 | } else { | 914 | } else { |
913 | skb_put(skb, len-4); | 915 | skb_put(skb, len-4); |
914 | memcpy(skb->data, self->rx_buff.data, len-4); | 916 | skb_copy_to_linear_data(skb, |
917 | self->rx_buff.data, | ||
918 | len - 4); | ||
915 | } | 919 | } |
916 | 920 | ||
917 | /* Move to next frame */ | 921 | /* Move to next frame */ |
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c index e729ced52dc3..dfde80e54aef 100644 --- a/drivers/net/ixgb/ixgb_main.c +++ b/drivers/net/ixgb/ixgb_main.c | |||
@@ -2017,9 +2017,12 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter) | |||
2017 | netdev_alloc_skb(netdev, length + NET_IP_ALIGN); | 2017 | netdev_alloc_skb(netdev, length + NET_IP_ALIGN); |
2018 | if (new_skb) { | 2018 | if (new_skb) { |
2019 | skb_reserve(new_skb, NET_IP_ALIGN); | 2019 | skb_reserve(new_skb, NET_IP_ALIGN); |
2020 | memcpy(new_skb->data - NET_IP_ALIGN, | 2020 | skb_copy_to_linear_data_offset(new_skb, |
2021 | skb->data - NET_IP_ALIGN, | 2021 | -NET_IP_ALIGN, |
2022 | length + NET_IP_ALIGN); | 2022 | (skb->data - |
2023 | NET_IP_ALIGN), | ||
2024 | (length + | ||
2025 | NET_IP_ALIGN)); | ||
2023 | /* save the skb in buffer_info as good */ | 2026 | /* save the skb in buffer_info as good */ |
2024 | buffer_info->skb = skb; | 2027 | buffer_info->skb = skb; |
2025 | skb = new_skb; | 2028 | skb = new_skb; |
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index 20b5cb101368..6df673a058ce 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c | |||
@@ -94,7 +94,8 @@ static void emulate_large_send_offload(struct sk_buff *skb) | |||
94 | skb_set_mac_header(nskb, -ETH_HLEN); | 94 | skb_set_mac_header(nskb, -ETH_HLEN); |
95 | skb_reset_network_header(nskb); | 95 | skb_reset_network_header(nskb); |
96 | iph = ip_hdr(nskb); | 96 | iph = ip_hdr(nskb); |
97 | memcpy(nskb->data, skb_network_header(skb), doffset); | 97 | skb_copy_to_linear_data(nskb, skb_network_header(skb), |
98 | doffset); | ||
98 | if (skb_copy_bits(skb, | 99 | if (skb_copy_bits(skb, |
99 | doffset + offset, | 100 | doffset + offset, |
100 | nskb->data + doffset, | 101 | nskb->data + doffset, |
diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 9e233f8216a7..0e04f7ac3f2e 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c | |||
@@ -367,9 +367,10 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag, | |||
367 | BUG_ON(frag != last_frag); | 367 | BUG_ON(frag != last_frag); |
368 | frag_len = len - offset; | 368 | frag_len = len - offset; |
369 | } | 369 | } |
370 | memcpy(skb->data + offset, | 370 | skb_copy_to_linear_data_offset(skb, offset, |
371 | bp->rx_buffers + (RX_BUFFER_SIZE * frag), | 371 | (bp->rx_buffers + |
372 | frag_len); | 372 | (RX_BUFFER_SIZE * frag)), |
373 | frag_len); | ||
373 | offset += RX_BUFFER_SIZE; | 374 | offset += RX_BUFFER_SIZE; |
374 | bp->rx_ring[frag].addr &= ~MACB_BIT(RX_USED); | 375 | bp->rx_ring[frag].addr &= ~MACB_BIT(RX_USED); |
375 | wmb(); | 376 | wmb(); |
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index e4b69a0485ba..16e3c4315e82 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c | |||
@@ -879,7 +879,7 @@ myri10ge_rx_skb_build(struct sk_buff *skb, u8 * va, | |||
879 | * skb_pull() (for ether_pad and eth_type_trans()) requires | 879 | * skb_pull() (for ether_pad and eth_type_trans()) requires |
880 | * the beginning of the packet in skb_headlen(), move it | 880 | * the beginning of the packet in skb_headlen(), move it |
881 | * manually */ | 881 | * manually */ |
882 | memcpy(skb->data, va, hlen); | 882 | skb_copy_to_linear_data(skb, va, hlen); |
883 | skb_shinfo(skb)->frags[0].page_offset += hlen; | 883 | skb_shinfo(skb)->frags[0].page_offset += hlen; |
884 | skb_shinfo(skb)->frags[0].size -= hlen; | 884 | skb_shinfo(skb)->frags[0].size -= hlen; |
885 | skb->data_len -= hlen; | 885 | skb->data_len -= hlen; |
diff --git a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c index b987a5c3f42a..e0a93005e6dc 100644 --- a/drivers/net/sk98lin/skge.c +++ b/drivers/net/sk98lin/skge.c | |||
@@ -2127,7 +2127,7 @@ rx_start: | |||
2127 | (dma_addr_t) PhysAddr, | 2127 | (dma_addr_t) PhysAddr, |
2128 | FrameLength, | 2128 | FrameLength, |
2129 | PCI_DMA_FROMDEVICE); | 2129 | PCI_DMA_FROMDEVICE); |
2130 | memcpy(pNewMsg->data, pMsg, FrameLength); | 2130 | skb_copy_to_linear_data(pNewMsg, pMsg, FrameLength); |
2131 | 2131 | ||
2132 | pci_dma_sync_single_for_device(pAC->PciDev, | 2132 | pci_dma_sync_single_for_device(pAC->PciDev, |
2133 | (dma_addr_t) PhysAddr, | 2133 | (dma_addr_t) PhysAddr, |
diff --git a/drivers/net/skfp/skfddi.c b/drivers/net/skfp/skfddi.c index 064e7c21c01d..a7ef6c8b7721 100644 --- a/drivers/net/skfp/skfddi.c +++ b/drivers/net/skfp/skfddi.c | |||
@@ -1937,7 +1937,7 @@ int mac_drv_rx_init(struct s_smc *smc, int len, int fc, | |||
1937 | } | 1937 | } |
1938 | skb_reserve(skb, 3); | 1938 | skb_reserve(skb, 3); |
1939 | skb_put(skb, len); | 1939 | skb_put(skb, len); |
1940 | memcpy(skb->data, look_ahead, len); | 1940 | skb_copy_to_linear_data(skb, look_ahead, len); |
1941 | 1941 | ||
1942 | // deliver frame to system | 1942 | // deliver frame to system |
1943 | skb->protocol = fddi_type_trans(skb, smc->os.dev); | 1943 | skb->protocol = fddi_type_trans(skb, smc->os.dev); |
diff --git a/drivers/net/sun3lance.c b/drivers/net/sun3lance.c index 327ed7962fbd..791e081fdc15 100644 --- a/drivers/net/sun3lance.c +++ b/drivers/net/sun3lance.c | |||
@@ -853,7 +853,7 @@ static int lance_rx( struct net_device *dev ) | |||
853 | 853 | ||
854 | skb_reserve( skb, 2 ); /* 16 byte align */ | 854 | skb_reserve( skb, 2 ); /* 16 byte align */ |
855 | skb_put( skb, pkt_len ); /* Make room */ | 855 | skb_put( skb, pkt_len ); /* Make room */ |
856 | // memcpy( skb->data, PKTBUF_ADDR(head), pkt_len ); | 856 | // skb_copy_to_linear_data(skb, PKTBUF_ADDR(head), pkt_len); |
857 | eth_copy_and_sum(skb, | 857 | eth_copy_and_sum(skb, |
858 | PKTBUF_ADDR(head), | 858 | PKTBUF_ADDR(head), |
859 | pkt_len, 0); | 859 | pkt_len, 0); |
diff --git a/drivers/net/tokenring/smctr.c b/drivers/net/tokenring/smctr.c index b0296d80e46c..9bbea5c8acf4 100644 --- a/drivers/net/tokenring/smctr.c +++ b/drivers/net/tokenring/smctr.c | |||
@@ -3889,7 +3889,7 @@ static int smctr_process_rx_packet(MAC_HEADER *rmf, __u16 size, | |||
3889 | 3889 | ||
3890 | /* Slide data into a sleek skb. */ | 3890 | /* Slide data into a sleek skb. */ |
3891 | skb_put(skb, skb->len); | 3891 | skb_put(skb, skb->len); |
3892 | memcpy(skb->data, rmf, skb->len); | 3892 | skb_copy_to_linear_data(skb, rmf, skb->len); |
3893 | 3893 | ||
3894 | /* Update Counters */ | 3894 | /* Update Counters */ |
3895 | tp->MacStat.rx_packets++; | 3895 | tp->MacStat.rx_packets++; |
@@ -4475,7 +4475,7 @@ static int smctr_rx_frame(struct net_device *dev) | |||
4475 | if (skb) { | 4475 | if (skb) { |
4476 | skb_put(skb, rx_size); | 4476 | skb_put(skb, rx_size); |
4477 | 4477 | ||
4478 | memcpy(skb->data, pbuff, rx_size); | 4478 | skb_copy_to_linear_data(skb, pbuff, rx_size); |
4479 | 4479 | ||
4480 | /* Update Counters */ | 4480 | /* Update Counters */ |
4481 | tp->MacStat.rx_packets++; | 4481 | tp->MacStat.rx_packets++; |
diff --git a/drivers/net/tokenring/tms380tr.c b/drivers/net/tokenring/tms380tr.c index e6f0817c3509..12bd294045a7 100644 --- a/drivers/net/tokenring/tms380tr.c +++ b/drivers/net/tokenring/tms380tr.c | |||
@@ -2178,7 +2178,8 @@ static void tms380tr_rcv_status_irq(struct net_device *dev) | |||
2178 | || rpl->SkbStat == SKB_DMA_DIRECT)) | 2178 | || rpl->SkbStat == SKB_DMA_DIRECT)) |
2179 | { | 2179 | { |
2180 | if(rpl->SkbStat == SKB_DATA_COPY) | 2180 | if(rpl->SkbStat == SKB_DATA_COPY) |
2181 | memcpy(skb->data, ReceiveDataPtr, Length); | 2181 | skb_copy_to_linear_data(skb, ReceiveDataPtr, |
2182 | Length); | ||
2182 | 2183 | ||
2183 | /* Deliver frame to system */ | 2184 | /* Deliver frame to system */ |
2184 | rpl->Skb = NULL; | 2185 | rpl->Skb = NULL; |
diff --git a/drivers/net/wan/dscc4.c b/drivers/net/wan/dscc4.c index 25021a7992a9..dca024471455 100644 --- a/drivers/net/wan/dscc4.c +++ b/drivers/net/wan/dscc4.c | |||
@@ -1904,7 +1904,8 @@ static struct sk_buff *dscc4_init_dummy_skb(struct dscc4_dev_priv *dpriv) | |||
1904 | struct TxFD *tx_fd = dpriv->tx_fd + last; | 1904 | struct TxFD *tx_fd = dpriv->tx_fd + last; |
1905 | 1905 | ||
1906 | skb->len = DUMMY_SKB_SIZE; | 1906 | skb->len = DUMMY_SKB_SIZE; |
1907 | memcpy(skb->data, version, strlen(version)%DUMMY_SKB_SIZE); | 1907 | skb_copy_to_linear_data(skb, version, |
1908 | strlen(version) % DUMMY_SKB_SIZE); | ||
1908 | tx_fd->state = FrameEnd | TO_STATE_TX(DUMMY_SKB_SIZE); | 1909 | tx_fd->state = FrameEnd | TO_STATE_TX(DUMMY_SKB_SIZE); |
1909 | tx_fd->data = pci_map_single(dpriv->pci_priv->pdev, skb->data, | 1910 | tx_fd->data = pci_map_single(dpriv->pci_priv->pdev, skb->data, |
1910 | DUMMY_SKB_SIZE, PCI_DMA_TODEVICE); | 1911 | DUMMY_SKB_SIZE, PCI_DMA_TODEVICE); |
diff --git a/drivers/net/wan/pc300_drv.c b/drivers/net/wan/pc300_drv.c index 8ba75bb17326..999bf71937ca 100644 --- a/drivers/net/wan/pc300_drv.c +++ b/drivers/net/wan/pc300_drv.c | |||
@@ -1759,7 +1759,7 @@ cpc_trace(struct net_device *dev, struct sk_buff *skb_main, char rx_tx) | |||
1759 | skb->pkt_type = PACKET_HOST; | 1759 | skb->pkt_type = PACKET_HOST; |
1760 | skb->len = 10 + skb_main->len; | 1760 | skb->len = 10 + skb_main->len; |
1761 | 1761 | ||
1762 | memcpy(skb->data, dev->name, 5); | 1762 | skb_copy_to_linear_data(skb, dev->name, 5); |
1763 | skb->data[5] = '['; | 1763 | skb->data[5] = '['; |
1764 | skb->data[6] = rx_tx; | 1764 | skb->data[6] = rx_tx; |
1765 | skb->data[7] = ']'; | 1765 | skb->data[7] = ']'; |
diff --git a/drivers/net/wan/pc300_tty.c b/drivers/net/wan/pc300_tty.c index de02a07259cf..07dbdfbfc15d 100644 --- a/drivers/net/wan/pc300_tty.c +++ b/drivers/net/wan/pc300_tty.c | |||
@@ -1007,13 +1007,13 @@ static void cpc_tty_trace(pc300dev_t *dev, char* buf, int len, char rxtx) | |||
1007 | skb->pkt_type = PACKET_HOST; | 1007 | skb->pkt_type = PACKET_HOST; |
1008 | skb->len = 10 + len; | 1008 | skb->len = 10 + len; |
1009 | 1009 | ||
1010 | memcpy(skb->data,dev->dev->name,5); | 1010 | skb_copy_to_linear_data(skb, dev->dev->name, 5); |
1011 | skb->data[5] = '['; | 1011 | skb->data[5] = '['; |
1012 | skb->data[6] = rxtx; | 1012 | skb->data[6] = rxtx; |
1013 | skb->data[7] = ']'; | 1013 | skb->data[7] = ']'; |
1014 | skb->data[8] = ':'; | 1014 | skb->data[8] = ':'; |
1015 | skb->data[9] = ' '; | 1015 | skb->data[9] = ' '; |
1016 | memcpy(&skb->data[10], buf, len); | 1016 | skb_copy_to_linear_data_offset(skb, 10, buf, len); |
1017 | netif_rx(skb); | 1017 | netif_rx(skb); |
1018 | } | 1018 | } |
1019 | 1019 | ||
diff --git a/drivers/net/wan/z85230.c b/drivers/net/wan/z85230.c index 9432d2ce7745..98ef400908b8 100644 --- a/drivers/net/wan/z85230.c +++ b/drivers/net/wan/z85230.c | |||
@@ -1656,7 +1656,7 @@ static void z8530_rx_done(struct z8530_channel *c) | |||
1656 | else | 1656 | else |
1657 | { | 1657 | { |
1658 | skb_put(skb, ct); | 1658 | skb_put(skb, ct); |
1659 | memcpy(skb->data, rxb, ct); | 1659 | skb_copy_to_linear_data(skb, rxb, ct); |
1660 | c->stats.rx_packets++; | 1660 | c->stats.rx_packets++; |
1661 | c->stats.rx_bytes+=ct; | 1661 | c->stats.rx_bytes+=ct; |
1662 | } | 1662 | } |
diff --git a/drivers/net/wireless/prism54/islpci_eth.c b/drivers/net/wireless/prism54/islpci_eth.c index 7d8bff1dbc4d..dd070cccf324 100644 --- a/drivers/net/wireless/prism54/islpci_eth.c +++ b/drivers/net/wireless/prism54/islpci_eth.c | |||
@@ -136,7 +136,7 @@ islpci_eth_transmit(struct sk_buff *skb, struct net_device *ndev) | |||
136 | printk("islpci_eth_transmit:wds_mac\n"); | 136 | printk("islpci_eth_transmit:wds_mac\n"); |
137 | #endif | 137 | #endif |
138 | memmove(skb->data + 6, src, skb->len); | 138 | memmove(skb->data + 6, src, skb->len); |
139 | memcpy(skb->data, wds_mac, 6); | 139 | skb_copy_to_linear_data(skb, wds_mac, 6); |
140 | } else { | 140 | } else { |
141 | memmove(skb->data, src, skb->len); | 141 | memmove(skb->data, src, skb->len); |
142 | } | 142 | } |
@@ -165,7 +165,7 @@ islpci_eth_transmit(struct sk_buff *skb, struct net_device *ndev) | |||
165 | skb_copy_from_linear_data(skb, | 165 | skb_copy_from_linear_data(skb, |
166 | newskb->data + 6, | 166 | newskb->data + 6, |
167 | skb->len); | 167 | skb->len); |
168 | memcpy(newskb->data, wds_mac, 6); | 168 | skb_copy_to_linear_data(newskb, wds_mac, 6); |
169 | #ifdef ISLPCI_ETH_DEBUG | 169 | #ifdef ISLPCI_ETH_DEBUG |
170 | printk("islpci_eth_transmit:wds_mac\n"); | 170 | printk("islpci_eth_transmit:wds_mac\n"); |
171 | #endif | 171 | #endif |
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c index df7f279ec408..ad7792dc1a04 100644 --- a/drivers/s390/net/qeth_main.c +++ b/drivers/s390/net/qeth_main.c | |||
@@ -2501,7 +2501,8 @@ qeth_process_inbound_buffer(struct qeth_card *card, | |||
2501 | vlan_tag = qeth_rebuild_skb(card, skb, hdr); | 2501 | vlan_tag = qeth_rebuild_skb(card, skb, hdr); |
2502 | else { /*in case of OSN*/ | 2502 | else { /*in case of OSN*/ |
2503 | skb_push(skb, sizeof(struct qeth_hdr)); | 2503 | skb_push(skb, sizeof(struct qeth_hdr)); |
2504 | memcpy(skb->data, hdr, sizeof(struct qeth_hdr)); | 2504 | skb_copy_to_linear_data(skb, hdr, |
2505 | sizeof(struct qeth_hdr)); | ||
2505 | } | 2506 | } |
2506 | /* is device UP ? */ | 2507 | /* is device UP ? */ |
2507 | if (!(card->dev->flags & IFF_UP)){ | 2508 | if (!(card->dev->flags & IFF_UP)){ |
@@ -3870,9 +3871,9 @@ __qeth_prepare_skb(struct qeth_card *card, struct sk_buff *skb, int ipv) | |||
3870 | * memcpys instead of one memmove to save cycles. | 3871 | * memcpys instead of one memmove to save cycles. |
3871 | */ | 3872 | */ |
3872 | skb_push(skb, VLAN_HLEN); | 3873 | skb_push(skb, VLAN_HLEN); |
3873 | memcpy(skb->data, skb->data + 4, 4); | 3874 | skb_copy_to_linear_data(skb, skb->data + 4, 4); |
3874 | memcpy(skb->data + 4, skb->data + 8, 4); | 3875 | skb_copy_to_linear_data_offset(skb, 4, skb->data + 8, 4); |
3875 | memcpy(skb->data + 8, skb->data + 12, 4); | 3876 | skb_copy_to_linear_data_offset(skb, 8, skb->data + 12, 4); |
3876 | tag = (u16 *)(skb->data + 12); | 3877 | tag = (u16 *)(skb->data + 12); |
3877 | /* | 3878 | /* |
3878 | * first two bytes = ETH_P_8021Q (0x8100) | 3879 | * first two bytes = ETH_P_8021Q (0x8100) |
diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c index d287c5755229..d3e2c5f90a26 100644 --- a/drivers/usb/atm/usbatm.c +++ b/drivers/usb/atm/usbatm.c | |||
@@ -396,7 +396,9 @@ static void usbatm_extract_one_cell(struct usbatm_data *instance, unsigned char | |||
396 | goto out; /* atm_charge increments rx_drop */ | 396 | goto out; /* atm_charge increments rx_drop */ |
397 | } | 397 | } |
398 | 398 | ||
399 | memcpy(skb->data, skb_tail_pointer(sarb) - pdu_length, length); | 399 | skb_copy_to_linear_data(skb, |
400 | skb_tail_pointer(sarb) - pdu_length, | ||
401 | length); | ||
400 | __skb_put(skb, length); | 402 | __skb_put(skb, length); |
401 | 403 | ||
402 | vdbg("%s: sending skb 0x%p, skb->len %u, skb->truesize %u", | 404 | vdbg("%s: sending skb 0x%p, skb->len %u, skb->truesize %u", |
diff --git a/drivers/usb/net/asix.c b/drivers/usb/net/asix.c index f56e2dab3712..d5ef97bc4d01 100644 --- a/drivers/usb/net/asix.c +++ b/drivers/usb/net/asix.c | |||
@@ -352,7 +352,7 @@ static struct sk_buff *asix_tx_fixup(struct usbnet *dev, struct sk_buff *skb, | |||
352 | skb_push(skb, 4); | 352 | skb_push(skb, 4); |
353 | packet_len = (((skb->len - 4) ^ 0x0000ffff) << 16) + (skb->len - 4); | 353 | packet_len = (((skb->len - 4) ^ 0x0000ffff) << 16) + (skb->len - 4); |
354 | cpu_to_le32s(&packet_len); | 354 | cpu_to_le32s(&packet_len); |
355 | memcpy(skb->data, &packet_len, sizeof(packet_len)); | 355 | skb_copy_to_linear_data(skb, &packet_len, sizeof(packet_len)); |
356 | 356 | ||
357 | if ((skb->len % 512) == 0) { | 357 | if ((skb->len % 512) == 0) { |
358 | cpu_to_le32s(&padbytes); | 358 | cpu_to_le32s(&padbytes); |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 08c96bcbc59c..92969f662ee4 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -1521,6 +1521,21 @@ static inline void skb_copy_from_linear_data_offset(const struct sk_buff *skb, | |||
1521 | memcpy(to, skb->data + offset, len); | 1521 | memcpy(to, skb->data + offset, len); |
1522 | } | 1522 | } |
1523 | 1523 | ||
1524 | static inline void skb_copy_to_linear_data(struct sk_buff *skb, | ||
1525 | const void *from, | ||
1526 | const unsigned int len) | ||
1527 | { | ||
1528 | memcpy(skb->data, from, len); | ||
1529 | } | ||
1530 | |||
1531 | static inline void skb_copy_to_linear_data_offset(struct sk_buff *skb, | ||
1532 | const int offset, | ||
1533 | const void *from, | ||
1534 | const unsigned int len) | ||
1535 | { | ||
1536 | memcpy(skb->data + offset, from, len); | ||
1537 | } | ||
1538 | |||
1524 | extern void skb_init(void); | 1539 | extern void skb_init(void); |
1525 | 1540 | ||
1526 | /** | 1541 | /** |
diff --git a/net/atm/br2684.c b/net/atm/br2684.c index a1686dfcbb9a..0e9f00c5c899 100644 --- a/net/atm/br2684.c +++ b/net/atm/br2684.c | |||
@@ -173,7 +173,7 @@ static int br2684_xmit_vcc(struct sk_buff *skb, struct br2684_dev *brdev, | |||
173 | } | 173 | } |
174 | skb_push(skb, minheadroom); | 174 | skb_push(skb, minheadroom); |
175 | if (brvcc->encaps == e_llc) | 175 | if (brvcc->encaps == e_llc) |
176 | memcpy(skb->data, llc_oui_pid_pad, 10); | 176 | skb_copy_to_linear_data(skb, llc_oui_pid_pad, 10); |
177 | else | 177 | else |
178 | memset(skb->data, 0, 2); | 178 | memset(skb->data, 0, 2); |
179 | #endif /* FASTER_VERSION */ | 179 | #endif /* FASTER_VERSION */ |
diff --git a/net/atm/lec.c b/net/atm/lec.c index 4b3e72f31b3b..6d63afa5764d 100644 --- a/net/atm/lec.c +++ b/net/atm/lec.c | |||
@@ -576,8 +576,8 @@ static int lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb) | |||
576 | break; | 576 | break; |
577 | } | 577 | } |
578 | skb2->len = sizeof(struct atmlec_msg); | 578 | skb2->len = sizeof(struct atmlec_msg); |
579 | memcpy(skb2->data, mesg, | 579 | skb_copy_to_linear_data(skb2, mesg, |
580 | sizeof(struct atmlec_msg)); | 580 | sizeof(*mesg)); |
581 | atm_force_charge(priv->lecd, skb2->truesize); | 581 | atm_force_charge(priv->lecd, skb2->truesize); |
582 | sk = sk_atm(priv->lecd); | 582 | sk = sk_atm(priv->lecd); |
583 | skb_queue_tail(&sk->sk_receive_queue, skb2); | 583 | skb_queue_tail(&sk->sk_receive_queue, skb2); |
@@ -1337,7 +1337,7 @@ static int lane2_resolve(struct net_device *dev, u8 *dst_mac, int force, | |||
1337 | if (skb == NULL) | 1337 | if (skb == NULL) |
1338 | return -1; | 1338 | return -1; |
1339 | skb->len = *sizeoftlvs; | 1339 | skb->len = *sizeoftlvs; |
1340 | memcpy(skb->data, *tlvs, *sizeoftlvs); | 1340 | skb_copy_to_linear_data(skb, *tlvs, *sizeoftlvs); |
1341 | retval = send_to_lecd(priv, l_arp_xmt, dst_mac, NULL, skb); | 1341 | retval = send_to_lecd(priv, l_arp_xmt, dst_mac, NULL, skb); |
1342 | } | 1342 | } |
1343 | return retval; | 1343 | return retval; |
@@ -1371,7 +1371,7 @@ static int lane2_associate_req(struct net_device *dev, u8 *lan_dst, | |||
1371 | if (skb == NULL) | 1371 | if (skb == NULL) |
1372 | return 0; | 1372 | return 0; |
1373 | skb->len = sizeoftlvs; | 1373 | skb->len = sizeoftlvs; |
1374 | memcpy(skb->data, tlvs, sizeoftlvs); | 1374 | skb_copy_to_linear_data(skb, tlvs, sizeoftlvs); |
1375 | retval = send_to_lecd(priv, l_associate_req, NULL, NULL, skb); | 1375 | retval = send_to_lecd(priv, l_associate_req, NULL, NULL, skb); |
1376 | if (retval != 0) | 1376 | if (retval != 0) |
1377 | printk("lec.c: lane2_associate_req() failed\n"); | 1377 | printk("lec.c: lane2_associate_req() failed\n"); |
diff --git a/net/atm/mpc.c b/net/atm/mpc.c index 4d2592c14090..813e08d6dc7c 100644 --- a/net/atm/mpc.c +++ b/net/atm/mpc.c | |||
@@ -504,11 +504,13 @@ static int send_via_shortcut(struct sk_buff *skb, struct mpoa_client *mpc) | |||
504 | tagged_llc_snap_hdr.tag = entry->ctrl_info.tag; | 504 | tagged_llc_snap_hdr.tag = entry->ctrl_info.tag; |
505 | skb_pull(skb, ETH_HLEN); /* get rid of Eth header */ | 505 | skb_pull(skb, ETH_HLEN); /* get rid of Eth header */ |
506 | skb_push(skb, sizeof(tagged_llc_snap_hdr)); /* add LLC/SNAP header */ | 506 | skb_push(skb, sizeof(tagged_llc_snap_hdr)); /* add LLC/SNAP header */ |
507 | memcpy(skb->data, &tagged_llc_snap_hdr, sizeof(tagged_llc_snap_hdr)); | 507 | skb_copy_to_linear_data(skb, &tagged_llc_snap_hdr, |
508 | sizeof(tagged_llc_snap_hdr)); | ||
508 | } else { | 509 | } else { |
509 | skb_pull(skb, ETH_HLEN); /* get rid of Eth header */ | 510 | skb_pull(skb, ETH_HLEN); /* get rid of Eth header */ |
510 | skb_push(skb, sizeof(struct llc_snap_hdr)); /* add LLC/SNAP header + tag */ | 511 | skb_push(skb, sizeof(struct llc_snap_hdr)); /* add LLC/SNAP header + tag */ |
511 | memcpy(skb->data, &llc_snap_mpoa_data, sizeof(struct llc_snap_hdr)); | 512 | skb_copy_to_linear_data(skb, &llc_snap_mpoa_data, |
513 | sizeof(struct llc_snap_hdr)); | ||
512 | } | 514 | } |
513 | 515 | ||
514 | atomic_add(skb->truesize, &sk_atm(entry->shortcut)->sk_wmem_alloc); | 516 | atomic_add(skb->truesize, &sk_atm(entry->shortcut)->sk_wmem_alloc); |
@@ -711,7 +713,8 @@ static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb) | |||
711 | return; | 713 | return; |
712 | } | 714 | } |
713 | skb_push(new_skb, eg->ctrl_info.DH_length); /* add MAC header */ | 715 | skb_push(new_skb, eg->ctrl_info.DH_length); /* add MAC header */ |
714 | memcpy(new_skb->data, eg->ctrl_info.DLL_header, eg->ctrl_info.DH_length); | 716 | skb_copy_to_linear_data(new_skb, eg->ctrl_info.DLL_header, |
717 | eg->ctrl_info.DH_length); | ||
715 | new_skb->protocol = eth_type_trans(new_skb, dev); | 718 | new_skb->protocol = eth_type_trans(new_skb, dev); |
716 | skb_reset_network_header(new_skb); | 719 | skb_reset_network_header(new_skb); |
717 | 720 | ||
@@ -936,7 +939,7 @@ int msg_to_mpoad(struct k_message *mesg, struct mpoa_client *mpc) | |||
936 | if (skb == NULL) | 939 | if (skb == NULL) |
937 | return -ENOMEM; | 940 | return -ENOMEM; |
938 | skb_put(skb, sizeof(struct k_message)); | 941 | skb_put(skb, sizeof(struct k_message)); |
939 | memcpy(skb->data, mesg, sizeof(struct k_message)); | 942 | skb_copy_to_linear_data(skb, mesg, sizeof(*mesg)); |
940 | atm_force_charge(mpc->mpoad_vcc, skb->truesize); | 943 | atm_force_charge(mpc->mpoad_vcc, skb->truesize); |
941 | 944 | ||
942 | sk = sk_atm(mpc->mpoad_vcc); | 945 | sk = sk_atm(mpc->mpoad_vcc); |
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index 8b45224699f4..fd70d041e51f 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c | |||
@@ -149,7 +149,8 @@ int nf_bridge_copy_header(struct sk_buff *skb) | |||
149 | if (err) | 149 | if (err) |
150 | return err; | 150 | return err; |
151 | 151 | ||
152 | memcpy(skb->data - header_size, skb->nf_bridge->data, header_size); | 152 | skb_copy_to_linear_data_offset(skb, -header_size, |
153 | skb->nf_bridge->data, header_size); | ||
153 | 154 | ||
154 | if (skb->protocol == htons(ETH_P_8021Q)) | 155 | if (skb->protocol == htons(ETH_P_8021Q)) |
155 | __skb_push(skb, VLAN_HLEN); | 156 | __skb_push(skb, VLAN_HLEN); |
diff --git a/net/core/netpoll.c b/net/core/netpoll.c index 57a82445c465..1fb30c3528bc 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c | |||
@@ -293,7 +293,7 @@ void netpoll_send_udp(struct netpoll *np, const char *msg, int len) | |||
293 | if (!skb) | 293 | if (!skb) |
294 | return; | 294 | return; |
295 | 295 | ||
296 | memcpy(skb->data, msg, len); | 296 | skb_copy_to_linear_data(skb, msg, len); |
297 | skb->len += len; | 297 | skb->len += len; |
298 | 298 | ||
299 | skb_push(skb, sizeof(*udph)); | 299 | skb_push(skb, sizeof(*udph)); |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 17c6bb5927b6..331d3efa82fa 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -1129,7 +1129,7 @@ int skb_store_bits(const struct sk_buff *skb, int offset, void *from, int len) | |||
1129 | if ((copy = start - offset) > 0) { | 1129 | if ((copy = start - offset) > 0) { |
1130 | if (copy > len) | 1130 | if (copy > len) |
1131 | copy = len; | 1131 | copy = len; |
1132 | memcpy(skb->data + offset, from, copy); | 1132 | skb_copy_to_linear_data_offset(skb, offset, from, copy); |
1133 | if ((len -= copy) == 0) | 1133 | if ((len -= copy) == 0) |
1134 | return 0; | 1134 | return 0; |
1135 | offset += copy; | 1135 | offset += copy; |
diff --git a/net/ieee80211/ieee80211_rx.c b/net/ieee80211/ieee80211_rx.c index 94e2b8e2ab26..6ae036b1920f 100644 --- a/net/ieee80211/ieee80211_rx.c +++ b/net/ieee80211/ieee80211_rx.c | |||
@@ -759,8 +759,9 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
759 | IEEE80211_FCTL_TODS) && skb->len >= ETH_HLEN + ETH_ALEN) { | 759 | IEEE80211_FCTL_TODS) && skb->len >= ETH_HLEN + ETH_ALEN) { |
760 | /* Non-standard frame: get addr4 from its bogus location after | 760 | /* Non-standard frame: get addr4 from its bogus location after |
761 | * the payload */ | 761 | * the payload */ |
762 | memcpy(skb->data + ETH_ALEN, | 762 | skb_copy_to_linear_data_offset(skb, ETH_ALEN, |
763 | skb->data + skb->len - ETH_ALEN, ETH_ALEN); | 763 | skb->data + skb->len - ETH_ALEN, |
764 | ETH_ALEN); | ||
764 | skb_trim(skb, skb->len - ETH_ALEN); | 765 | skb_trim(skb, skb->len - ETH_ALEN); |
765 | } | 766 | } |
766 | #endif | 767 | #endif |
diff --git a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c index ba348b1e5f84..ab86137c71d2 100644 --- a/net/ipv4/ipcomp.c +++ b/net/ipv4/ipcomp.c | |||
@@ -66,7 +66,7 @@ static int ipcomp_decompress(struct xfrm_state *x, struct sk_buff *skb) | |||
66 | 66 | ||
67 | skb->truesize += dlen - plen; | 67 | skb->truesize += dlen - plen; |
68 | __skb_put(skb, dlen - plen); | 68 | __skb_put(skb, dlen - plen); |
69 | memcpy(skb->data, scratch, dlen); | 69 | skb_copy_to_linear_data(skb, scratch, dlen); |
70 | out: | 70 | out: |
71 | put_cpu(); | 71 | put_cpu(); |
72 | return err; | 72 | return err; |
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 48027df5a90b..0ebae413ae87 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -584,7 +584,7 @@ static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert) | |||
584 | 584 | ||
585 | skb->network_header = skb->tail; | 585 | skb->network_header = skb->tail; |
586 | skb_put(skb, ihl); | 586 | skb_put(skb, ihl); |
587 | memcpy(skb->data,pkt->data,ihl); | 587 | skb_copy_to_linear_data(skb, pkt->data, ihl); |
588 | ip_hdr(skb)->protocol = 0; /* Flag to the kernel this is a route add */ | 588 | ip_hdr(skb)->protocol = 0; /* Flag to the kernel this is a route add */ |
589 | msg = (struct igmpmsg *)skb_network_header(skb); | 589 | msg = (struct igmpmsg *)skb_network_header(skb); |
590 | msg->im_vif = vifi; | 590 | msg->im_vif = vifi; |
diff --git a/net/ipv4/ipvs/ip_vs_app.c b/net/ipv4/ipvs/ip_vs_app.c index c8a822c0aa75..15ad5dd2d984 100644 --- a/net/ipv4/ipvs/ip_vs_app.c +++ b/net/ipv4/ipvs/ip_vs_app.c | |||
@@ -602,7 +602,7 @@ int ip_vs_skb_replace(struct sk_buff *skb, gfp_t pri, | |||
602 | skb_put(skb, diff); | 602 | skb_put(skb, diff); |
603 | memmove(skb->data + o_offset + n_len, | 603 | memmove(skb->data + o_offset + n_len, |
604 | skb->data + o_offset + o_len, o_left); | 604 | skb->data + o_offset + o_len, o_left); |
605 | memcpy(skb->data + o_offset, n_buf, n_len); | 605 | skb_copy_to_linear_data_offset(skb, o_offset, n_buf, n_len); |
606 | } | 606 | } |
607 | 607 | ||
608 | /* must update the iph total length here */ | 608 | /* must update the iph total length here */ |
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c index cd8fec05f9bc..0d72693869e6 100644 --- a/net/ipv4/netfilter/ip_queue.c +++ b/net/ipv4/netfilter/ip_queue.c | |||
@@ -368,7 +368,7 @@ ipq_mangle_ipv4(ipq_verdict_msg_t *v, struct ipq_queue_entry *e) | |||
368 | } | 368 | } |
369 | if (!skb_make_writable(&e->skb, v->data_len)) | 369 | if (!skb_make_writable(&e->skb, v->data_len)) |
370 | return -ENOMEM; | 370 | return -ENOMEM; |
371 | memcpy(e->skb->data, v->payload, v->data_len); | 371 | skb_copy_to_linear_data(e->skb, v->payload, v->data_len); |
372 | e->skb->ip_summed = CHECKSUM_NONE; | 372 | e->skb->ip_summed = CHECKSUM_NONE; |
373 | 373 | ||
374 | return 0; | 374 | return 0; |
diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c index 7691a1b5caac..1ee50b5782e1 100644 --- a/net/ipv6/ipcomp6.c +++ b/net/ipv6/ipcomp6.c | |||
@@ -111,7 +111,7 @@ static int ipcomp6_input(struct xfrm_state *x, struct sk_buff *skb) | |||
111 | 111 | ||
112 | skb->truesize += dlen - plen; | 112 | skb->truesize += dlen - plen; |
113 | __skb_put(skb, dlen - plen); | 113 | __skb_put(skb, dlen - plen); |
114 | memcpy(skb->data, scratch, dlen); | 114 | skb_copy_to_linear_data(skb, scratch, dlen); |
115 | err = ipch->nexthdr; | 115 | err = ipch->nexthdr; |
116 | 116 | ||
117 | out_put_cpu: | 117 | out_put_cpu: |
diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c index 2f1ae422d87f..bfae9fdc4668 100644 --- a/net/ipv6/netfilter/ip6_queue.c +++ b/net/ipv6/netfilter/ip6_queue.c | |||
@@ -366,7 +366,7 @@ ipq_mangle_ipv6(ipq_verdict_msg_t *v, struct ipq_queue_entry *e) | |||
366 | } | 366 | } |
367 | if (!skb_make_writable(&e->skb, v->data_len)) | 367 | if (!skb_make_writable(&e->skb, v->data_len)) |
368 | return -ENOMEM; | 368 | return -ENOMEM; |
369 | memcpy(e->skb->data, v->payload, v->data_len); | 369 | skb_copy_to_linear_data(e->skb, v->payload, v->data_len); |
370 | e->skb->ip_summed = CHECKSUM_NONE; | 370 | e->skb->ip_summed = CHECKSUM_NONE; |
371 | 371 | ||
372 | return 0; | 372 | return 0; |
diff --git a/net/irda/irttp.c b/net/irda/irttp.c index b55bc8f989df..3279897a01b0 100644 --- a/net/irda/irttp.c +++ b/net/irda/irttp.c | |||
@@ -256,7 +256,7 @@ static struct sk_buff *irttp_reassemble_skb(struct tsap_cb *self) | |||
256 | * Copy all fragments to a new buffer | 256 | * Copy all fragments to a new buffer |
257 | */ | 257 | */ |
258 | while ((frag = skb_dequeue(&self->rx_fragments)) != NULL) { | 258 | while ((frag = skb_dequeue(&self->rx_fragments)) != NULL) { |
259 | memcpy(skb->data+n, frag->data, frag->len); | 259 | skb_copy_to_linear_data_offset(skb, n, frag->data, frag->len); |
260 | n += frag->len; | 260 | n += frag->len; |
261 | 261 | ||
262 | dev_kfree_skb(frag); | 262 | dev_kfree_skb(frag); |
diff --git a/net/irda/wrapper.c b/net/irda/wrapper.c index 2acc66dfb558..a7a7f191f1a8 100644 --- a/net/irda/wrapper.c +++ b/net/irda/wrapper.c | |||
@@ -239,7 +239,8 @@ async_bump(struct net_device *dev, | |||
239 | 239 | ||
240 | if(docopy) { | 240 | if(docopy) { |
241 | /* Copy data without CRC (lenght already checked) */ | 241 | /* Copy data without CRC (lenght already checked) */ |
242 | memcpy(newskb->data, rx_buff->data, rx_buff->len - 2); | 242 | skb_copy_to_linear_data(newskb, rx_buff->data, |
243 | rx_buff->len - 2); | ||
243 | /* Deliver this skb */ | 244 | /* Deliver this skb */ |
244 | dataskb = newskb; | 245 | dataskb = newskb; |
245 | } else { | 246 | } else { |
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c index 9aefb1c9bfa3..7a97bec67729 100644 --- a/net/netfilter/nfnetlink_queue.c +++ b/net/netfilter/nfnetlink_queue.c | |||
@@ -648,7 +648,7 @@ nfqnl_mangle(void *data, int data_len, struct nfqnl_queue_entry *e) | |||
648 | } | 648 | } |
649 | if (!skb_make_writable(&e->skb, data_len)) | 649 | if (!skb_make_writable(&e->skb, data_len)) |
650 | return -ENOMEM; | 650 | return -ENOMEM; |
651 | memcpy(e->skb->data, data, data_len); | 651 | skb_copy_to_linear_data(e->skb, data, data_len); |
652 | e->skb->ip_summed = CHECKSUM_NONE; | 652 | e->skb->ip_summed = CHECKSUM_NONE; |
653 | return 0; | 653 | return 0; |
654 | } | 654 | } |
diff --git a/net/netrom/nr_out.c b/net/netrom/nr_out.c index 7c467c95c7d6..e3e6c44e1890 100644 --- a/net/netrom/nr_out.c +++ b/net/netrom/nr_out.c | |||
@@ -59,8 +59,8 @@ void nr_output(struct sock *sk, struct sk_buff *skb) | |||
59 | 59 | ||
60 | /* Duplicate the Transport Header */ | 60 | /* Duplicate the Transport Header */ |
61 | skb_push(skbn, NR_TRANSPORT_LEN); | 61 | skb_push(skbn, NR_TRANSPORT_LEN); |
62 | memcpy(skbn->data, transport, NR_TRANSPORT_LEN); | 62 | skb_copy_to_linear_data(skbn, transport, |
63 | 63 | NR_TRANSPORT_LEN); | |
64 | if (skb->len > 0) | 64 | if (skb->len > 0) |
65 | skbn->data[4] |= NR_MORE_FLAG; | 65 | skbn->data[4] |= NR_MORE_FLAG; |
66 | 66 | ||
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c index f38c3b3471ee..806bf6f5dc6d 100644 --- a/net/rose/af_rose.c +++ b/net/rose/af_rose.c | |||
@@ -1181,7 +1181,7 @@ static int rose_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
1181 | 1181 | ||
1182 | /* Duplicate the Header */ | 1182 | /* Duplicate the Header */ |
1183 | skb_push(skbn, ROSE_MIN_LEN); | 1183 | skb_push(skbn, ROSE_MIN_LEN); |
1184 | memcpy(skbn->data, header, ROSE_MIN_LEN); | 1184 | skb_copy_to_linear_data(skbn, header, ROSE_MIN_LEN); |
1185 | 1185 | ||
1186 | if (skb->len > 0) | 1186 | if (skb->len > 0) |
1187 | skbn->data[2] |= M_BIT; | 1187 | skbn->data[2] |= M_BIT; |
diff --git a/net/tipc/link.c b/net/tipc/link.c index 71c2f2fd405c..f3f99c8ea08a 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c | |||
@@ -1001,7 +1001,7 @@ static int link_bundle_buf(struct link *l_ptr, | |||
1001 | return 0; | 1001 | return 0; |
1002 | 1002 | ||
1003 | skb_put(bundler, pad + size); | 1003 | skb_put(bundler, pad + size); |
1004 | memcpy(bundler->data + to_pos, buf->data, size); | 1004 | skb_copy_to_linear_data_offset(bundler, to_pos, buf->data, size); |
1005 | msg_set_size(bundler_msg, to_pos + size); | 1005 | msg_set_size(bundler_msg, to_pos + size); |
1006 | msg_set_msgcnt(bundler_msg, msg_msgcnt(bundler_msg) + 1); | 1006 | msg_set_msgcnt(bundler_msg, msg_msgcnt(bundler_msg) + 1); |
1007 | dbg("Packed msg # %u(%u octets) into pos %u in buf(#%u)\n", | 1007 | dbg("Packed msg # %u(%u octets) into pos %u in buf(#%u)\n", |
@@ -1109,8 +1109,8 @@ int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf) | |||
1109 | if (bundler) { | 1109 | if (bundler) { |
1110 | msg_init(&bundler_hdr, MSG_BUNDLER, OPEN_MSG, | 1110 | msg_init(&bundler_hdr, MSG_BUNDLER, OPEN_MSG, |
1111 | TIPC_OK, INT_H_SIZE, l_ptr->addr); | 1111 | TIPC_OK, INT_H_SIZE, l_ptr->addr); |
1112 | memcpy(bundler->data, (unchar *)&bundler_hdr, | 1112 | skb_copy_to_linear_data(bundler, &bundler_hdr, |
1113 | INT_H_SIZE); | 1113 | INT_H_SIZE); |
1114 | skb_trim(bundler, INT_H_SIZE); | 1114 | skb_trim(bundler, INT_H_SIZE); |
1115 | link_bundle_buf(l_ptr, bundler, buf); | 1115 | link_bundle_buf(l_ptr, bundler, buf); |
1116 | buf = bundler; | 1116 | buf = bundler; |
@@ -1383,9 +1383,9 @@ again: | |||
1383 | if (!buf) | 1383 | if (!buf) |
1384 | return -ENOMEM; | 1384 | return -ENOMEM; |
1385 | buf->next = NULL; | 1385 | buf->next = NULL; |
1386 | memcpy(buf->data, (unchar *)&fragm_hdr, INT_H_SIZE); | 1386 | skb_copy_to_linear_data(buf, &fragm_hdr, INT_H_SIZE); |
1387 | hsz = msg_hdr_sz(hdr); | 1387 | hsz = msg_hdr_sz(hdr); |
1388 | memcpy(buf->data + INT_H_SIZE, (unchar *)hdr, hsz); | 1388 | skb_copy_to_linear_data_offset(buf, INT_H_SIZE, hdr, hsz); |
1389 | msg_dbg(buf_msg(buf), ">BUILD>"); | 1389 | msg_dbg(buf_msg(buf), ">BUILD>"); |
1390 | 1390 | ||
1391 | /* Chop up message: */ | 1391 | /* Chop up message: */ |
@@ -1416,8 +1416,8 @@ error: | |||
1416 | return -EFAULT; | 1416 | return -EFAULT; |
1417 | } | 1417 | } |
1418 | } else | 1418 | } else |
1419 | memcpy(buf->data + fragm_crs, sect_crs, sz); | 1419 | skb_copy_to_linear_data_offset(buf, fragm_crs, |
1420 | 1420 | sect_crs, sz); | |
1421 | sect_crs += sz; | 1421 | sect_crs += sz; |
1422 | sect_rest -= sz; | 1422 | sect_rest -= sz; |
1423 | fragm_crs += sz; | 1423 | fragm_crs += sz; |
@@ -1442,7 +1442,7 @@ error: | |||
1442 | 1442 | ||
1443 | buf->next = NULL; | 1443 | buf->next = NULL; |
1444 | prev->next = buf; | 1444 | prev->next = buf; |
1445 | memcpy(buf->data, (unchar *)&fragm_hdr, INT_H_SIZE); | 1445 | skb_copy_to_linear_data(buf, &fragm_hdr, INT_H_SIZE); |
1446 | fragm_crs = INT_H_SIZE; | 1446 | fragm_crs = INT_H_SIZE; |
1447 | fragm_rest = fragm_sz; | 1447 | fragm_rest = fragm_sz; |
1448 | msg_dbg(buf_msg(buf)," >BUILD>"); | 1448 | msg_dbg(buf_msg(buf)," >BUILD>"); |
@@ -2130,7 +2130,7 @@ void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg, | |||
2130 | buf = l_ptr->proto_msg_queue; | 2130 | buf = l_ptr->proto_msg_queue; |
2131 | if (!buf) | 2131 | if (!buf) |
2132 | return; | 2132 | return; |
2133 | memcpy(buf->data, (unchar *)msg, sizeof(l_ptr->proto_msg)); | 2133 | skb_copy_to_linear_data(buf, msg, sizeof(l_ptr->proto_msg)); |
2134 | return; | 2134 | return; |
2135 | } | 2135 | } |
2136 | msg_set_timestamp(msg, jiffies_to_msecs(jiffies)); | 2136 | msg_set_timestamp(msg, jiffies_to_msecs(jiffies)); |
@@ -2143,7 +2143,7 @@ void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg, | |||
2143 | if (!buf) | 2143 | if (!buf) |
2144 | return; | 2144 | return; |
2145 | 2145 | ||
2146 | memcpy(buf->data, (unchar *)msg, sizeof(l_ptr->proto_msg)); | 2146 | skb_copy_to_linear_data(buf, msg, sizeof(l_ptr->proto_msg)); |
2147 | msg_set_size(buf_msg(buf), msg_size); | 2147 | msg_set_size(buf_msg(buf), msg_size); |
2148 | 2148 | ||
2149 | if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { | 2149 | if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { |
@@ -2319,8 +2319,8 @@ void tipc_link_tunnel(struct link *l_ptr, | |||
2319 | "unable to send tunnel msg\n"); | 2319 | "unable to send tunnel msg\n"); |
2320 | return; | 2320 | return; |
2321 | } | 2321 | } |
2322 | memcpy(buf->data, (unchar *)tunnel_hdr, INT_H_SIZE); | 2322 | skb_copy_to_linear_data(buf, tunnel_hdr, INT_H_SIZE); |
2323 | memcpy(buf->data + INT_H_SIZE, (unchar *)msg, length); | 2323 | skb_copy_to_linear_data_offset(buf, INT_H_SIZE, msg, length); |
2324 | dbg("%c->%c:", l_ptr->b_ptr->net_plane, tunnel->b_ptr->net_plane); | 2324 | dbg("%c->%c:", l_ptr->b_ptr->net_plane, tunnel->b_ptr->net_plane); |
2325 | msg_dbg(buf_msg(buf), ">SEND>"); | 2325 | msg_dbg(buf_msg(buf), ">SEND>"); |
2326 | tipc_link_send_buf(tunnel, buf); | 2326 | tipc_link_send_buf(tunnel, buf); |
@@ -2361,7 +2361,7 @@ void tipc_link_changeover(struct link *l_ptr) | |||
2361 | 2361 | ||
2362 | buf = buf_acquire(INT_H_SIZE); | 2362 | buf = buf_acquire(INT_H_SIZE); |
2363 | if (buf) { | 2363 | if (buf) { |
2364 | memcpy(buf->data, (unchar *)&tunnel_hdr, INT_H_SIZE); | 2364 | skb_copy_to_linear_data(buf, &tunnel_hdr, INT_H_SIZE); |
2365 | msg_set_size(&tunnel_hdr, INT_H_SIZE); | 2365 | msg_set_size(&tunnel_hdr, INT_H_SIZE); |
2366 | dbg("%c->%c:", l_ptr->b_ptr->net_plane, | 2366 | dbg("%c->%c:", l_ptr->b_ptr->net_plane, |
2367 | tunnel->b_ptr->net_plane); | 2367 | tunnel->b_ptr->net_plane); |
@@ -2426,8 +2426,9 @@ void tipc_link_send_duplicate(struct link *l_ptr, struct link *tunnel) | |||
2426 | "unable to send duplicate msg\n"); | 2426 | "unable to send duplicate msg\n"); |
2427 | return; | 2427 | return; |
2428 | } | 2428 | } |
2429 | memcpy(outbuf->data, (unchar *)&tunnel_hdr, INT_H_SIZE); | 2429 | skb_copy_to_linear_data(outbuf, &tunnel_hdr, INT_H_SIZE); |
2430 | memcpy(outbuf->data + INT_H_SIZE, iter->data, length); | 2430 | skb_copy_to_linear_data_offset(outbuf, INT_H_SIZE, iter->data, |
2431 | length); | ||
2431 | dbg("%c->%c:", l_ptr->b_ptr->net_plane, | 2432 | dbg("%c->%c:", l_ptr->b_ptr->net_plane, |
2432 | tunnel->b_ptr->net_plane); | 2433 | tunnel->b_ptr->net_plane); |
2433 | msg_dbg(buf_msg(outbuf), ">SEND>"); | 2434 | msg_dbg(buf_msg(outbuf), ">SEND>"); |
@@ -2457,7 +2458,7 @@ static struct sk_buff *buf_extract(struct sk_buff *skb, u32 from_pos) | |||
2457 | 2458 | ||
2458 | eb = buf_acquire(size); | 2459 | eb = buf_acquire(size); |
2459 | if (eb) | 2460 | if (eb) |
2460 | memcpy(eb->data, (unchar *)msg, size); | 2461 | skb_copy_to_linear_data(eb, msg, size); |
2461 | return eb; | 2462 | return eb; |
2462 | } | 2463 | } |
2463 | 2464 | ||
@@ -2631,9 +2632,9 @@ int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf) | |||
2631 | goto exit; | 2632 | goto exit; |
2632 | } | 2633 | } |
2633 | msg_set_size(&fragm_hdr, fragm_sz + INT_H_SIZE); | 2634 | msg_set_size(&fragm_hdr, fragm_sz + INT_H_SIZE); |
2634 | memcpy(fragm->data, (unchar *)&fragm_hdr, INT_H_SIZE); | 2635 | skb_copy_to_linear_data(fragm, &fragm_hdr, INT_H_SIZE); |
2635 | memcpy(fragm->data + INT_H_SIZE, crs, fragm_sz); | 2636 | skb_copy_to_linear_data_offset(fragm, INT_H_SIZE, crs, |
2636 | 2637 | fragm_sz); | |
2637 | /* Send queued messages first, if any: */ | 2638 | /* Send queued messages first, if any: */ |
2638 | 2639 | ||
2639 | l_ptr->stats.sent_fragments++; | 2640 | l_ptr->stats.sent_fragments++; |
@@ -2733,8 +2734,8 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb, | |||
2733 | if (pbuf != NULL) { | 2734 | if (pbuf != NULL) { |
2734 | pbuf->next = *pending; | 2735 | pbuf->next = *pending; |
2735 | *pending = pbuf; | 2736 | *pending = pbuf; |
2736 | memcpy(pbuf->data, (unchar *)imsg, msg_data_sz(fragm)); | 2737 | skb_copy_to_linear_data(pbuf, imsg, |
2737 | 2738 | msg_data_sz(fragm)); | |
2738 | /* Prepare buffer for subsequent fragments. */ | 2739 | /* Prepare buffer for subsequent fragments. */ |
2739 | 2740 | ||
2740 | set_long_msg_seqno(pbuf, long_msg_seq_no); | 2741 | set_long_msg_seqno(pbuf, long_msg_seq_no); |
@@ -2750,7 +2751,8 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb, | |||
2750 | u32 fsz = get_fragm_size(pbuf); | 2751 | u32 fsz = get_fragm_size(pbuf); |
2751 | u32 crs = ((msg_fragm_no(fragm) - 1) * fsz); | 2752 | u32 crs = ((msg_fragm_no(fragm) - 1) * fsz); |
2752 | u32 exp_frags = get_expected_frags(pbuf) - 1; | 2753 | u32 exp_frags = get_expected_frags(pbuf) - 1; |
2753 | memcpy(pbuf->data + crs, msg_data(fragm), dsz); | 2754 | skb_copy_to_linear_data_offset(pbuf, crs, |
2755 | msg_data(fragm), dsz); | ||
2754 | buf_discard(fbuf); | 2756 | buf_discard(fbuf); |
2755 | 2757 | ||
2756 | /* Is message complete? */ | 2758 | /* Is message complete? */ |
diff --git a/net/tipc/msg.h b/net/tipc/msg.h index 62d549063604..aec7ce7af875 100644 --- a/net/tipc/msg.h +++ b/net/tipc/msg.h | |||
@@ -786,15 +786,16 @@ static inline int msg_build(struct tipc_msg *hdr, | |||
786 | *buf = buf_acquire(sz); | 786 | *buf = buf_acquire(sz); |
787 | if (!(*buf)) | 787 | if (!(*buf)) |
788 | return -ENOMEM; | 788 | return -ENOMEM; |
789 | memcpy((*buf)->data, (unchar *)hdr, hsz); | 789 | skb_copy_to_linear_data(*buf, hdr, hsz); |
790 | for (res = 1, cnt = 0; res && (cnt < num_sect); cnt++) { | 790 | for (res = 1, cnt = 0; res && (cnt < num_sect); cnt++) { |
791 | if (likely(usrmem)) | 791 | if (likely(usrmem)) |
792 | res = !copy_from_user((*buf)->data + pos, | 792 | res = !copy_from_user((*buf)->data + pos, |
793 | msg_sect[cnt].iov_base, | 793 | msg_sect[cnt].iov_base, |
794 | msg_sect[cnt].iov_len); | 794 | msg_sect[cnt].iov_len); |
795 | else | 795 | else |
796 | memcpy((*buf)->data + pos, msg_sect[cnt].iov_base, | 796 | skb_copy_to_linear_data_offset(*buf, pos, |
797 | msg_sect[cnt].iov_len); | 797 | msg_sect[cnt].iov_base, |
798 | msg_sect[cnt].iov_len); | ||
798 | pos += msg_sect[cnt].iov_len; | 799 | pos += msg_sect[cnt].iov_len; |
799 | } | 800 | } |
800 | if (likely(res)) | 801 | if (likely(res)) |
diff --git a/net/tipc/port.c b/net/tipc/port.c index 5f8217d4b452..bcd5da00737b 100644 --- a/net/tipc/port.c +++ b/net/tipc/port.c | |||
@@ -464,7 +464,7 @@ int tipc_reject_msg(struct sk_buff *buf, u32 err) | |||
464 | msg_set_size(rmsg, data_sz + hdr_sz); | 464 | msg_set_size(rmsg, data_sz + hdr_sz); |
465 | msg_set_nametype(rmsg, msg_nametype(msg)); | 465 | msg_set_nametype(rmsg, msg_nametype(msg)); |
466 | msg_set_nameinst(rmsg, msg_nameinst(msg)); | 466 | msg_set_nameinst(rmsg, msg_nameinst(msg)); |
467 | memcpy(rbuf->data + hdr_sz, msg_data(msg), data_sz); | 467 | skb_copy_to_linear_data_offset(rbuf, hdr_sz, msg_data(msg), data_sz); |
468 | 468 | ||
469 | /* send self-abort message when rejecting on a connected port */ | 469 | /* send self-abort message when rejecting on a connected port */ |
470 | if (msg_connected(msg)) { | 470 | if (msg_connected(msg)) { |
@@ -1419,7 +1419,7 @@ int tipc_send_buf(u32 ref, struct sk_buff *buf, unsigned int dsz) | |||
1419 | return -ENOMEM; | 1419 | return -ENOMEM; |
1420 | 1420 | ||
1421 | skb_push(buf, hsz); | 1421 | skb_push(buf, hsz); |
1422 | memcpy(buf->data, (unchar *)msg, hsz); | 1422 | skb_copy_to_linear_data(buf, msg, hsz); |
1423 | destnode = msg_destnode(msg); | 1423 | destnode = msg_destnode(msg); |
1424 | p_ptr->publ.congested = 1; | 1424 | p_ptr->publ.congested = 1; |
1425 | if (!tipc_port_congested(p_ptr)) { | 1425 | if (!tipc_port_congested(p_ptr)) { |
@@ -1555,7 +1555,7 @@ int tipc_forward_buf2name(u32 ref, | |||
1555 | if (skb_cow(buf, LONG_H_SIZE)) | 1555 | if (skb_cow(buf, LONG_H_SIZE)) |
1556 | return -ENOMEM; | 1556 | return -ENOMEM; |
1557 | skb_push(buf, LONG_H_SIZE); | 1557 | skb_push(buf, LONG_H_SIZE); |
1558 | memcpy(buf->data, (unchar *)msg, LONG_H_SIZE); | 1558 | skb_copy_to_linear_data(buf, msg, LONG_H_SIZE); |
1559 | msg_dbg(buf_msg(buf),"PREP:"); | 1559 | msg_dbg(buf_msg(buf),"PREP:"); |
1560 | if (likely(destport || destnode)) { | 1560 | if (likely(destport || destnode)) { |
1561 | p_ptr->sent++; | 1561 | p_ptr->sent++; |
@@ -1679,7 +1679,7 @@ int tipc_forward_buf2port(u32 ref, | |||
1679 | return -ENOMEM; | 1679 | return -ENOMEM; |
1680 | 1680 | ||
1681 | skb_push(buf, DIR_MSG_H_SIZE); | 1681 | skb_push(buf, DIR_MSG_H_SIZE); |
1682 | memcpy(buf->data, (unchar *)msg, DIR_MSG_H_SIZE); | 1682 | skb_copy_to_linear_data(buf, msg, DIR_MSG_H_SIZE); |
1683 | msg_dbg(msg, "buf2port: "); | 1683 | msg_dbg(msg, "buf2port: "); |
1684 | p_ptr->sent++; | 1684 | p_ptr->sent++; |
1685 | if (dest->node == tipc_own_addr) | 1685 | if (dest->node == tipc_own_addr) |
diff --git a/net/wanrouter/wanmain.c b/net/wanrouter/wanmain.c index c49e223084f1..7a19e0ede289 100644 --- a/net/wanrouter/wanmain.c +++ b/net/wanrouter/wanmain.c | |||
@@ -277,8 +277,8 @@ int wanrouter_encapsulate(struct sk_buff *skb, struct net_device *dev, | |||
277 | skb_push(skb, 7); | 277 | skb_push(skb, 7); |
278 | skb->data[0] = 0; | 278 | skb->data[0] = 0; |
279 | skb->data[1] = NLPID_SNAP; | 279 | skb->data[1] = NLPID_SNAP; |
280 | memcpy(&skb->data[2], wanrouter_oui_ether, | 280 | skb_copy_to_linear_data_offset(skb, 2, wanrouter_oui_ether, |
281 | sizeof(wanrouter_oui_ether)); | 281 | sizeof(wanrouter_oui_ether)); |
282 | *((unsigned short*)&skb->data[5]) = htons(type); | 282 | *((unsigned short*)&skb->data[5]) = htons(type); |
283 | break; | 283 | break; |
284 | 284 | ||
diff --git a/net/x25/x25_out.c b/net/x25/x25_out.c index bb45e21ffce9..2b96b52114d6 100644 --- a/net/x25/x25_out.c +++ b/net/x25/x25_out.c | |||
@@ -89,7 +89,7 @@ int x25_output(struct sock *sk, struct sk_buff *skb) | |||
89 | 89 | ||
90 | /* Duplicate the Header */ | 90 | /* Duplicate the Header */ |
91 | skb_push(skbn, header_len); | 91 | skb_push(skbn, header_len); |
92 | memcpy(skbn->data, header, header_len); | 92 | skb_copy_to_linear_data(skbn, header, header_len); |
93 | 93 | ||
94 | if (skb->len > 0) { | 94 | if (skb->len > 0) { |
95 | if (x25->neighbour->extended) | 95 | if (x25->neighbour->extended) |