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 /net | |
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>
Diffstat (limited to 'net')
-rw-r--r-- | net/atm/br2684.c | 2 | ||||
-rw-r--r-- | net/atm/lec.c | 8 | ||||
-rw-r--r-- | net/atm/mpc.c | 11 | ||||
-rw-r--r-- | net/bridge/br_netfilter.c | 3 | ||||
-rw-r--r-- | net/core/netpoll.c | 2 | ||||
-rw-r--r-- | net/core/skbuff.c | 2 | ||||
-rw-r--r-- | net/ieee80211/ieee80211_rx.c | 5 | ||||
-rw-r--r-- | net/ipv4/ipcomp.c | 2 | ||||
-rw-r--r-- | net/ipv4/ipmr.c | 2 | ||||
-rw-r--r-- | net/ipv4/ipvs/ip_vs_app.c | 2 | ||||
-rw-r--r-- | net/ipv4/netfilter/ip_queue.c | 2 | ||||
-rw-r--r-- | net/ipv6/ipcomp6.c | 2 | ||||
-rw-r--r-- | net/ipv6/netfilter/ip6_queue.c | 2 | ||||
-rw-r--r-- | net/irda/irttp.c | 2 | ||||
-rw-r--r-- | net/irda/wrapper.c | 3 | ||||
-rw-r--r-- | net/netfilter/nfnetlink_queue.c | 2 | ||||
-rw-r--r-- | net/netrom/nr_out.c | 4 | ||||
-rw-r--r-- | net/rose/af_rose.c | 2 | ||||
-rw-r--r-- | net/tipc/link.c | 46 | ||||
-rw-r--r-- | net/tipc/msg.h | 7 | ||||
-rw-r--r-- | net/tipc/port.c | 8 | ||||
-rw-r--r-- | net/wanrouter/wanmain.c | 4 | ||||
-rw-r--r-- | net/x25/x25_out.c | 2 |
23 files changed, 67 insertions, 58 deletions
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) |