diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2007-03-27 17:55:52 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:28:23 -0400 |
commit | d626f62b11e00c16e81e4308ab93d3f13551812a (patch) | |
tree | fac4af6ced853755e12fc709d55f0c2bec51265d /net | |
parent | 2a123b86e2b242a4a6db990d2851d45e192f88e5 (diff) |
[SK_BUFF]: Introduce skb_copy_from_linear_data{_offset}
To clearly state the intent of copying from 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@redhat.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/ax25/ax25_out.c | 4 | ||||
-rw-r--r-- | net/bluetooth/bnep/core.c | 2 | ||||
-rw-r--r-- | net/bluetooth/cmtp/core.c | 4 | ||||
-rw-r--r-- | net/bluetooth/l2cap.c | 6 | ||||
-rw-r--r-- | net/bridge/br_netfilter.c | 3 | ||||
-rw-r--r-- | net/core/skbuff.c | 17 | ||||
-rw-r--r-- | net/decnet/dn_nsp_in.c | 5 | ||||
-rw-r--r-- | net/ieee80211/ieee80211_crypt_wep.c | 2 | ||||
-rw-r--r-- | net/ieee80211/ieee80211_rx.c | 6 | ||||
-rw-r--r-- | net/ieee80211/ieee80211_tx.c | 8 | ||||
-rw-r--r-- | net/ipv4/ip_output.c | 2 | ||||
-rw-r--r-- | net/ipv6/ip6_output.c | 2 | ||||
-rw-r--r-- | net/irda/irttp.c | 4 | ||||
-rw-r--r-- | net/netrom/af_netrom.c | 3 | ||||
-rw-r--r-- | net/netrom/nr_loopback.c | 2 | ||||
-rw-r--r-- | net/netrom/nr_out.c | 4 | ||||
-rw-r--r-- | net/netrom/nr_subr.c | 4 | ||||
-rw-r--r-- | net/rose/af_rose.c | 4 | ||||
-rw-r--r-- | net/x25/af_x25.c | 2 | ||||
-rw-r--r-- | net/x25/x25_in.c | 5 | ||||
-rw-r--r-- | net/x25/x25_out.c | 4 |
21 files changed, 50 insertions, 43 deletions
diff --git a/net/ax25/ax25_out.c b/net/ax25/ax25_out.c index e66953ce53e7..92b517af7260 100644 --- a/net/ax25/ax25_out.c +++ b/net/ax25/ax25_out.c | |||
@@ -150,7 +150,7 @@ void ax25_output(ax25_cb *ax25, int paclen, struct sk_buff *skb) | |||
150 | skb_reserve(skbn, frontlen + 2); | 150 | skb_reserve(skbn, frontlen + 2); |
151 | skb_set_network_header(skbn, | 151 | skb_set_network_header(skbn, |
152 | skb_network_offset(skb)); | 152 | skb_network_offset(skb)); |
153 | memcpy(skb_put(skbn, len), skb->data, len); | 153 | skb_copy_from_linear_data(skb, skb_put(skbn, len), len); |
154 | p = skb_push(skbn, 2); | 154 | p = skb_push(skbn, 2); |
155 | 155 | ||
156 | *p++ = AX25_P_SEGMENT; | 156 | *p++ = AX25_P_SEGMENT; |
@@ -164,7 +164,7 @@ void ax25_output(ax25_cb *ax25, int paclen, struct sk_buff *skb) | |||
164 | skb_reserve(skbn, frontlen + 1); | 164 | skb_reserve(skbn, frontlen + 1); |
165 | skb_set_network_header(skbn, | 165 | skb_set_network_header(skbn, |
166 | skb_network_offset(skb)); | 166 | skb_network_offset(skb)); |
167 | memcpy(skb_put(skbn, len), skb->data, len); | 167 | skb_copy_from_linear_data(skb, skb_put(skbn, len), len); |
168 | p = skb_push(skbn, 1); | 168 | p = skb_push(skbn, 1); |
169 | *p = AX25_P_TEXT; | 169 | *p = AX25_P_TEXT; |
170 | } | 170 | } |
diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c index 97156c4abc8d..ab2db55982ca 100644 --- a/net/bluetooth/bnep/core.c +++ b/net/bluetooth/bnep/core.c | |||
@@ -382,7 +382,7 @@ static inline int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb) | |||
382 | break; | 382 | break; |
383 | } | 383 | } |
384 | 384 | ||
385 | memcpy(__skb_put(nskb, skb->len), skb->data, skb->len); | 385 | skb_copy_from_linear_data(skb, __skb_put(nskb, skb->len), skb->len); |
386 | kfree_skb(skb); | 386 | kfree_skb(skb); |
387 | 387 | ||
388 | s->stats.rx_packets++; | 388 | s->stats.rx_packets++; |
diff --git a/net/bluetooth/cmtp/core.c b/net/bluetooth/cmtp/core.c index 3933608a9296..66bef1ccee2a 100644 --- a/net/bluetooth/cmtp/core.c +++ b/net/bluetooth/cmtp/core.c | |||
@@ -124,7 +124,7 @@ static inline void cmtp_add_msgpart(struct cmtp_session *session, int id, const | |||
124 | } | 124 | } |
125 | 125 | ||
126 | if (skb && (skb->len > 0)) | 126 | if (skb && (skb->len > 0)) |
127 | memcpy(skb_put(nskb, skb->len), skb->data, skb->len); | 127 | skb_copy_from_linear_data(skb, skb_put(nskb, skb->len), skb->len); |
128 | 128 | ||
129 | memcpy(skb_put(nskb, count), buf, count); | 129 | memcpy(skb_put(nskb, count), buf, count); |
130 | 130 | ||
@@ -256,7 +256,7 @@ static void cmtp_process_transmit(struct cmtp_session *session) | |||
256 | hdr[2] = size >> 8; | 256 | hdr[2] = size >> 8; |
257 | } | 257 | } |
258 | 258 | ||
259 | memcpy(skb_put(nskb, size), skb->data, size); | 259 | skb_copy_from_linear_data(skb, skb_put(nskb, size), size); |
260 | skb_pull(skb, size); | 260 | skb_pull(skb, size); |
261 | 261 | ||
262 | if (skb->len > 0) { | 262 | if (skb->len > 0) { |
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index 162eab6a4478..a5867879b615 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c | |||
@@ -2107,7 +2107,8 @@ static int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 fl | |||
2107 | if (!(conn->rx_skb = bt_skb_alloc(len, GFP_ATOMIC))) | 2107 | if (!(conn->rx_skb = bt_skb_alloc(len, GFP_ATOMIC))) |
2108 | goto drop; | 2108 | goto drop; |
2109 | 2109 | ||
2110 | memcpy(skb_put(conn->rx_skb, skb->len), skb->data, skb->len); | 2110 | skb_copy_from_linear_data(skb, skb_put(conn->rx_skb, skb->len), |
2111 | skb->len); | ||
2111 | conn->rx_len = len - skb->len; | 2112 | conn->rx_len = len - skb->len; |
2112 | } else { | 2113 | } else { |
2113 | BT_DBG("Cont: frag len %d (expecting %d)", skb->len, conn->rx_len); | 2114 | BT_DBG("Cont: frag len %d (expecting %d)", skb->len, conn->rx_len); |
@@ -2128,7 +2129,8 @@ static int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 fl | |||
2128 | goto drop; | 2129 | goto drop; |
2129 | } | 2130 | } |
2130 | 2131 | ||
2131 | memcpy(skb_put(conn->rx_skb, skb->len), skb->data, skb->len); | 2132 | skb_copy_from_linear_data(skb, skb_put(conn->rx_skb, skb->len), |
2133 | skb->len); | ||
2132 | conn->rx_len -= skb->len; | 2134 | conn->rx_len -= skb->len; |
2133 | 2135 | ||
2134 | if (!conn->rx_len) { | 2136 | if (!conn->rx_len) { |
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index 8cee7fdc16c3..8b45224699f4 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c | |||
@@ -129,7 +129,8 @@ static inline void nf_bridge_save_header(struct sk_buff *skb) | |||
129 | if (skb->protocol == htons(ETH_P_8021Q)) | 129 | if (skb->protocol == htons(ETH_P_8021Q)) |
130 | header_size += VLAN_HLEN; | 130 | header_size += VLAN_HLEN; |
131 | 131 | ||
132 | memcpy(skb->nf_bridge->data, skb->data - header_size, header_size); | 132 | skb_copy_from_linear_data_offset(skb, -header_size, |
133 | skb->nf_bridge->data, header_size); | ||
133 | } | 134 | } |
134 | 135 | ||
135 | /* | 136 | /* |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index f16c72204cf6..17c6bb5927b6 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -576,7 +576,7 @@ struct sk_buff *pskb_copy(struct sk_buff *skb, gfp_t gfp_mask) | |||
576 | /* Set the tail pointer and length */ | 576 | /* Set the tail pointer and length */ |
577 | skb_put(n, skb_headlen(skb)); | 577 | skb_put(n, skb_headlen(skb)); |
578 | /* Copy the bytes */ | 578 | /* Copy the bytes */ |
579 | memcpy(n->data, skb->data, n->len); | 579 | skb_copy_from_linear_data(skb, n->data, n->len); |
580 | n->csum = skb->csum; | 580 | n->csum = skb->csum; |
581 | n->ip_summed = skb->ip_summed; | 581 | n->ip_summed = skb->ip_summed; |
582 | 582 | ||
@@ -1043,7 +1043,7 @@ int skb_copy_bits(const struct sk_buff *skb, int offset, void *to, int len) | |||
1043 | if ((copy = start - offset) > 0) { | 1043 | if ((copy = start - offset) > 0) { |
1044 | if (copy > len) | 1044 | if (copy > len) |
1045 | copy = len; | 1045 | copy = len; |
1046 | memcpy(to, skb->data + offset, copy); | 1046 | skb_copy_from_linear_data_offset(skb, offset, to, copy); |
1047 | if ((len -= copy) == 0) | 1047 | if ((len -= copy) == 0) |
1048 | return 0; | 1048 | return 0; |
1049 | offset += copy; | 1049 | offset += copy; |
@@ -1362,7 +1362,7 @@ void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to) | |||
1362 | 1362 | ||
1363 | BUG_ON(csstart > skb_headlen(skb)); | 1363 | BUG_ON(csstart > skb_headlen(skb)); |
1364 | 1364 | ||
1365 | memcpy(to, skb->data, csstart); | 1365 | skb_copy_from_linear_data(skb, to, csstart); |
1366 | 1366 | ||
1367 | csum = 0; | 1367 | csum = 0; |
1368 | if (csstart != skb->len) | 1368 | if (csstart != skb->len) |
@@ -1536,8 +1536,8 @@ static inline void skb_split_inside_header(struct sk_buff *skb, | |||
1536 | { | 1536 | { |
1537 | int i; | 1537 | int i; |
1538 | 1538 | ||
1539 | memcpy(skb_put(skb1, pos - len), skb->data + len, pos - len); | 1539 | skb_copy_from_linear_data_offset(skb, len, skb_put(skb1, pos - len), |
1540 | 1540 | pos - len); | |
1541 | /* And move data appendix as is. */ | 1541 | /* And move data appendix as is. */ |
1542 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) | 1542 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) |
1543 | skb_shinfo(skb1)->frags[i] = skb_shinfo(skb)->frags[i]; | 1543 | skb_shinfo(skb1)->frags[i] = skb_shinfo(skb)->frags[i]; |
@@ -1927,8 +1927,8 @@ struct sk_buff *skb_segment(struct sk_buff *skb, int features) | |||
1927 | skb_set_network_header(nskb, skb->mac_len); | 1927 | skb_set_network_header(nskb, skb->mac_len); |
1928 | nskb->transport_header = (nskb->network_header + | 1928 | nskb->transport_header = (nskb->network_header + |
1929 | skb_network_header_len(skb)); | 1929 | skb_network_header_len(skb)); |
1930 | memcpy(skb_put(nskb, doffset), skb->data, doffset); | 1930 | skb_copy_from_linear_data(skb, skb_put(nskb, doffset), |
1931 | 1931 | doffset); | |
1932 | if (!sg) { | 1932 | if (!sg) { |
1933 | nskb->csum = skb_copy_and_csum_bits(skb, offset, | 1933 | nskb->csum = skb_copy_and_csum_bits(skb, offset, |
1934 | skb_put(nskb, len), | 1934 | skb_put(nskb, len), |
@@ -1941,7 +1941,8 @@ struct sk_buff *skb_segment(struct sk_buff *skb, int features) | |||
1941 | 1941 | ||
1942 | nskb->ip_summed = CHECKSUM_PARTIAL; | 1942 | nskb->ip_summed = CHECKSUM_PARTIAL; |
1943 | nskb->csum = skb->csum; | 1943 | nskb->csum = skb->csum; |
1944 | memcpy(skb_put(nskb, hsize), skb->data + offset, hsize); | 1944 | skb_copy_from_linear_data_offset(skb, offset, |
1945 | skb_put(nskb, hsize), hsize); | ||
1945 | 1946 | ||
1946 | while (pos < offset + len) { | 1947 | while (pos < offset + len) { |
1947 | BUG_ON(i >= nfrags); | 1948 | BUG_ON(i >= nfrags); |
diff --git a/net/decnet/dn_nsp_in.c b/net/decnet/dn_nsp_in.c index d9498a165acf..4074a6e5d0de 100644 --- a/net/decnet/dn_nsp_in.c +++ b/net/decnet/dn_nsp_in.c | |||
@@ -362,7 +362,8 @@ static void dn_nsp_conn_conf(struct sock *sk, struct sk_buff *skb) | |||
362 | u16 dlen = *skb->data; | 362 | u16 dlen = *skb->data; |
363 | if ((dlen <= 16) && (dlen <= skb->len)) { | 363 | if ((dlen <= 16) && (dlen <= skb->len)) { |
364 | scp->conndata_in.opt_optl = dn_htons(dlen); | 364 | scp->conndata_in.opt_optl = dn_htons(dlen); |
365 | memcpy(scp->conndata_in.opt_data, skb->data + 1, dlen); | 365 | skb_copy_from_linear_data_offset(skb, 1, |
366 | scp->conndata_in.opt_data, dlen); | ||
366 | } | 367 | } |
367 | } | 368 | } |
368 | dn_nsp_send_link(sk, DN_NOCHANGE, 0); | 369 | dn_nsp_send_link(sk, DN_NOCHANGE, 0); |
@@ -406,7 +407,7 @@ static void dn_nsp_disc_init(struct sock *sk, struct sk_buff *skb) | |||
406 | u16 dlen = *skb->data; | 407 | u16 dlen = *skb->data; |
407 | if ((dlen <= 16) && (dlen <= skb->len)) { | 408 | if ((dlen <= 16) && (dlen <= skb->len)) { |
408 | scp->discdata_in.opt_optl = dn_htons(dlen); | 409 | scp->discdata_in.opt_optl = dn_htons(dlen); |
409 | memcpy(scp->discdata_in.opt_data, skb->data + 1, dlen); | 410 | skb_copy_from_linear_data_offset(skb, 1, scp->discdata_in.opt_data, dlen); |
410 | } | 411 | } |
411 | } | 412 | } |
412 | 413 | ||
diff --git a/net/ieee80211/ieee80211_crypt_wep.c b/net/ieee80211/ieee80211_crypt_wep.c index ec6d8851a061..4eb35079e434 100644 --- a/net/ieee80211/ieee80211_crypt_wep.c +++ b/net/ieee80211/ieee80211_crypt_wep.c | |||
@@ -152,7 +152,7 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
152 | return -1; | 152 | return -1; |
153 | 153 | ||
154 | /* Copy the IV into the first 3 bytes of the key */ | 154 | /* Copy the IV into the first 3 bytes of the key */ |
155 | memcpy(key, skb->data + hdr_len, 3); | 155 | skb_copy_from_linear_data_offset(skb, hdr_len, key, 3); |
156 | 156 | ||
157 | /* Copy rest of the WEP key (the secret part) */ | 157 | /* Copy rest of the WEP key (the secret part) */ |
158 | memcpy(key + 3, wep->key, wep->key_len); | 158 | memcpy(key + 3, wep->key, wep->key_len); |
diff --git a/net/ieee80211/ieee80211_rx.c b/net/ieee80211/ieee80211_rx.c index 59a765c49cf9..94e2b8e2ab26 100644 --- a/net/ieee80211/ieee80211_rx.c +++ b/net/ieee80211/ieee80211_rx.c | |||
@@ -606,12 +606,12 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
606 | if (frag == 0) { | 606 | if (frag == 0) { |
607 | /* copy first fragment (including full headers) into | 607 | /* copy first fragment (including full headers) into |
608 | * beginning of the fragment cache skb */ | 608 | * beginning of the fragment cache skb */ |
609 | memcpy(skb_put(frag_skb, flen), skb->data, flen); | 609 | skb_copy_from_linear_data(skb, skb_put(frag_skb, flen), flen); |
610 | } else { | 610 | } else { |
611 | /* append frame payload to the end of the fragment | 611 | /* append frame payload to the end of the fragment |
612 | * cache skb */ | 612 | * cache skb */ |
613 | memcpy(skb_put(frag_skb, flen), skb->data + hdrlen, | 613 | skb_copy_from_linear_data_offset(skb, hdrlen, |
614 | flen); | 614 | skb_put(frag_skb, flen), flen); |
615 | } | 615 | } |
616 | dev_kfree_skb_any(skb); | 616 | dev_kfree_skb_any(skb); |
617 | skb = NULL; | 617 | skb = NULL; |
diff --git a/net/ieee80211/ieee80211_tx.c b/net/ieee80211/ieee80211_tx.c index 62a8a2b76539..a4c3c51140a3 100644 --- a/net/ieee80211/ieee80211_tx.c +++ b/net/ieee80211/ieee80211_tx.c | |||
@@ -309,8 +309,8 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) | |||
309 | } | 309 | } |
310 | 310 | ||
311 | /* Save source and destination addresses */ | 311 | /* Save source and destination addresses */ |
312 | memcpy(dest, skb->data, ETH_ALEN); | 312 | skb_copy_from_linear_data(skb, dest, ETH_ALEN); |
313 | memcpy(src, skb->data + ETH_ALEN, ETH_ALEN); | 313 | skb_copy_from_linear_data_offset(skb, ETH_ALEN, src, ETH_ALEN); |
314 | 314 | ||
315 | if (host_encrypt || host_build_iv) | 315 | if (host_encrypt || host_build_iv) |
316 | fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA | | 316 | fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA | |
@@ -363,7 +363,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) | |||
363 | snapped = 1; | 363 | snapped = 1; |
364 | ieee80211_copy_snap(skb_put(skb_new, SNAP_SIZE + sizeof(u16)), | 364 | ieee80211_copy_snap(skb_put(skb_new, SNAP_SIZE + sizeof(u16)), |
365 | ether_type); | 365 | ether_type); |
366 | memcpy(skb_put(skb_new, skb->len), skb->data, skb->len); | 366 | skb_copy_from_linear_data(skb, skb_put(skb_new, skb->len), skb->len); |
367 | res = crypt->ops->encrypt_msdu(skb_new, hdr_len, crypt->priv); | 367 | res = crypt->ops->encrypt_msdu(skb_new, hdr_len, crypt->priv); |
368 | if (res < 0) { | 368 | if (res < 0) { |
369 | IEEE80211_ERROR("msdu encryption failed\n"); | 369 | IEEE80211_ERROR("msdu encryption failed\n"); |
@@ -492,7 +492,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) | |||
492 | bytes -= SNAP_SIZE + sizeof(u16); | 492 | bytes -= SNAP_SIZE + sizeof(u16); |
493 | } | 493 | } |
494 | 494 | ||
495 | memcpy(skb_put(skb_frag, bytes), skb->data, bytes); | 495 | skb_copy_from_linear_data(skb, skb_put(skb_frag, bytes), bytes); |
496 | 496 | ||
497 | /* Advance the SKB... */ | 497 | /* Advance the SKB... */ |
498 | skb_pull(skb, bytes); | 498 | skb_pull(skb, bytes); |
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 875da382d9b9..34606eff8a05 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -596,7 +596,7 @@ slow_path: | |||
596 | * Copy the packet header into the new buffer. | 596 | * Copy the packet header into the new buffer. |
597 | */ | 597 | */ |
598 | 598 | ||
599 | memcpy(skb_network_header(skb2), skb->data, hlen); | 599 | skb_copy_from_linear_data(skb, skb_network_header(skb2), hlen); |
600 | 600 | ||
601 | /* | 601 | /* |
602 | * Copy a block of the IP datagram. | 602 | * Copy a block of the IP datagram. |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index be3f082a87ed..4cfdad4e8356 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -746,7 +746,7 @@ slow_path: | |||
746 | /* | 746 | /* |
747 | * Copy the packet header into the new buffer. | 747 | * Copy the packet header into the new buffer. |
748 | */ | 748 | */ |
749 | memcpy(skb_network_header(frag), skb->data, hlen); | 749 | skb_copy_from_linear_data(skb, skb_network_header(frag), hlen); |
750 | 750 | ||
751 | /* | 751 | /* |
752 | * Build fragment header. | 752 | * Build fragment header. |
diff --git a/net/irda/irttp.c b/net/irda/irttp.c index da3f2bc1b6f6..b55bc8f989df 100644 --- a/net/irda/irttp.c +++ b/net/irda/irttp.c | |||
@@ -314,8 +314,8 @@ static inline void irttp_fragment_skb(struct tsap_cb *self, | |||
314 | skb_reserve(frag, self->max_header_size); | 314 | skb_reserve(frag, self->max_header_size); |
315 | 315 | ||
316 | /* Copy data from the original skb into this fragment. */ | 316 | /* Copy data from the original skb into this fragment. */ |
317 | memcpy(skb_put(frag, self->max_seg_size), skb->data, | 317 | skb_copy_from_linear_data(skb, skb_put(frag, self->max_seg_size), |
318 | self->max_seg_size); | 318 | self->max_seg_size); |
319 | 319 | ||
320 | /* Insert TTP header, with the more bit set */ | 320 | /* Insert TTP header, with the more bit set */ |
321 | frame = skb_push(frag, TTP_HEADER); | 321 | frame = skb_push(frag, TTP_HEADER); |
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c index 053fa26ff90a..5dc7448925db 100644 --- a/net/netrom/af_netrom.c +++ b/net/netrom/af_netrom.c | |||
@@ -1160,7 +1160,8 @@ static int nr_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1160 | 1160 | ||
1161 | if (sax != NULL) { | 1161 | if (sax != NULL) { |
1162 | sax->sax25_family = AF_NETROM; | 1162 | sax->sax25_family = AF_NETROM; |
1163 | memcpy(sax->sax25_call.ax25_call, skb->data + 7, AX25_ADDR_LEN); | 1163 | skb_copy_from_linear_data_offset(skb, 7, sax->sax25_call.ax25_call, |
1164 | AX25_ADDR_LEN); | ||
1164 | } | 1165 | } |
1165 | 1166 | ||
1166 | msg->msg_namelen = sizeof(*sax); | 1167 | msg->msg_namelen = sizeof(*sax); |
diff --git a/net/netrom/nr_loopback.c b/net/netrom/nr_loopback.c index 99fdab16ded0..f324d5df4186 100644 --- a/net/netrom/nr_loopback.c +++ b/net/netrom/nr_loopback.c | |||
@@ -34,7 +34,7 @@ int nr_loopback_queue(struct sk_buff *skb) | |||
34 | struct sk_buff *skbn; | 34 | struct sk_buff *skbn; |
35 | 35 | ||
36 | if ((skbn = alloc_skb(skb->len, GFP_ATOMIC)) != NULL) { | 36 | if ((skbn = alloc_skb(skb->len, GFP_ATOMIC)) != NULL) { |
37 | memcpy(skb_put(skbn, skb->len), skb->data, skb->len); | 37 | skb_copy_from_linear_data(skb, skb_put(skbn, skb->len), skb->len); |
38 | skb_reset_transport_header(skbn); | 38 | skb_reset_transport_header(skbn); |
39 | 39 | ||
40 | skb_queue_tail(&loopback_queue, skbn); | 40 | skb_queue_tail(&loopback_queue, skbn); |
diff --git a/net/netrom/nr_out.c b/net/netrom/nr_out.c index 0cbfb611465b..7c467c95c7d6 100644 --- a/net/netrom/nr_out.c +++ b/net/netrom/nr_out.c | |||
@@ -40,7 +40,7 @@ void nr_output(struct sock *sk, struct sk_buff *skb) | |||
40 | 40 | ||
41 | if (skb->len - NR_TRANSPORT_LEN > NR_MAX_PACKET_SIZE) { | 41 | if (skb->len - NR_TRANSPORT_LEN > NR_MAX_PACKET_SIZE) { |
42 | /* Save a copy of the Transport Header */ | 42 | /* Save a copy of the Transport Header */ |
43 | memcpy(transport, skb->data, NR_TRANSPORT_LEN); | 43 | skb_copy_from_linear_data(skb, transport, NR_TRANSPORT_LEN); |
44 | skb_pull(skb, NR_TRANSPORT_LEN); | 44 | skb_pull(skb, NR_TRANSPORT_LEN); |
45 | 45 | ||
46 | frontlen = skb_headroom(skb); | 46 | frontlen = skb_headroom(skb); |
@@ -54,7 +54,7 @@ void nr_output(struct sock *sk, struct sk_buff *skb) | |||
54 | len = (NR_MAX_PACKET_SIZE > skb->len) ? skb->len : NR_MAX_PACKET_SIZE; | 54 | len = (NR_MAX_PACKET_SIZE > skb->len) ? skb->len : NR_MAX_PACKET_SIZE; |
55 | 55 | ||
56 | /* Copy the user data */ | 56 | /* Copy the user data */ |
57 | memcpy(skb_put(skbn, len), skb->data, len); | 57 | skb_copy_from_linear_data(skb, skb_put(skbn, len), len); |
58 | skb_pull(skb, len); | 58 | skb_pull(skb, len); |
59 | 59 | ||
60 | /* Duplicate the Transport Header */ | 60 | /* Duplicate the Transport Header */ |
diff --git a/net/netrom/nr_subr.c b/net/netrom/nr_subr.c index 07b694d18870..04e7d0d2fd8f 100644 --- a/net/netrom/nr_subr.c +++ b/net/netrom/nr_subr.c | |||
@@ -226,13 +226,13 @@ void __nr_transmit_reply(struct sk_buff *skb, int mine, unsigned char cmdflags) | |||
226 | 226 | ||
227 | dptr = skb_put(skbn, NR_NETWORK_LEN + NR_TRANSPORT_LEN); | 227 | dptr = skb_put(skbn, NR_NETWORK_LEN + NR_TRANSPORT_LEN); |
228 | 228 | ||
229 | memcpy(dptr, skb->data + 7, AX25_ADDR_LEN); | 229 | skb_copy_from_linear_data_offset(skb, 7, dptr, AX25_ADDR_LEN); |
230 | dptr[6] &= ~AX25_CBIT; | 230 | dptr[6] &= ~AX25_CBIT; |
231 | dptr[6] &= ~AX25_EBIT; | 231 | dptr[6] &= ~AX25_EBIT; |
232 | dptr[6] |= AX25_SSSID_SPARE; | 232 | dptr[6] |= AX25_SSSID_SPARE; |
233 | dptr += AX25_ADDR_LEN; | 233 | dptr += AX25_ADDR_LEN; |
234 | 234 | ||
235 | memcpy(dptr, skb->data + 0, AX25_ADDR_LEN); | 235 | skb_copy_from_linear_data(skb, dptr, AX25_ADDR_LEN); |
236 | dptr[6] &= ~AX25_CBIT; | 236 | dptr[6] &= ~AX25_CBIT; |
237 | dptr[6] |= AX25_EBIT; | 237 | dptr[6] |= AX25_EBIT; |
238 | dptr[6] |= AX25_SSSID_SPARE; | 238 | dptr[6] |= AX25_SSSID_SPARE; |
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c index 1511697b22ba..f38c3b3471ee 100644 --- a/net/rose/af_rose.c +++ b/net/rose/af_rose.c | |||
@@ -1156,7 +1156,7 @@ static int rose_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
1156 | int lg; | 1156 | int lg; |
1157 | 1157 | ||
1158 | /* Save a copy of the Header */ | 1158 | /* Save a copy of the Header */ |
1159 | memcpy(header, skb->data, ROSE_MIN_LEN); | 1159 | skb_copy_from_linear_data(skb, header, ROSE_MIN_LEN); |
1160 | skb_pull(skb, ROSE_MIN_LEN); | 1160 | skb_pull(skb, ROSE_MIN_LEN); |
1161 | 1161 | ||
1162 | frontlen = skb_headroom(skb); | 1162 | frontlen = skb_headroom(skb); |
@@ -1176,7 +1176,7 @@ static int rose_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
1176 | lg = (ROSE_PACLEN > skb->len) ? skb->len : ROSE_PACLEN; | 1176 | lg = (ROSE_PACLEN > skb->len) ? skb->len : ROSE_PACLEN; |
1177 | 1177 | ||
1178 | /* Copy the user data */ | 1178 | /* Copy the user data */ |
1179 | memcpy(skb_put(skbn, lg), skb->data, lg); | 1179 | skb_copy_from_linear_data(skb, skb_put(skbn, lg), lg); |
1180 | skb_pull(skb, lg); | 1180 | skb_pull(skb, lg); |
1181 | 1181 | ||
1182 | /* Duplicate the Header */ | 1182 | /* Duplicate the Header */ |
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index adcda8ebee9c..0d6002fc77b2 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c | |||
@@ -951,7 +951,7 @@ int x25_rx_call_request(struct sk_buff *skb, struct x25_neigh *nb, | |||
951 | * Incoming Call User Data. | 951 | * Incoming Call User Data. |
952 | */ | 952 | */ |
953 | if (skb->len >= 0) { | 953 | if (skb->len >= 0) { |
954 | memcpy(makex25->calluserdata.cuddata, skb->data, skb->len); | 954 | skb_copy_from_linear_data(skb, makex25->calluserdata.cuddata, skb->len); |
955 | makex25->calluserdata.cudlength = skb->len; | 955 | makex25->calluserdata.cudlength = skb->len; |
956 | } | 956 | } |
957 | 957 | ||
diff --git a/net/x25/x25_in.c b/net/x25/x25_in.c index b2bbe552a89d..ba13248aa1c3 100644 --- a/net/x25/x25_in.c +++ b/net/x25/x25_in.c | |||
@@ -112,8 +112,9 @@ static int x25_state1_machine(struct sock *sk, struct sk_buff *skb, int frametyp | |||
112 | * Copy any Call User Data. | 112 | * Copy any Call User Data. |
113 | */ | 113 | */ |
114 | if (skb->len >= 0) { | 114 | if (skb->len >= 0) { |
115 | memcpy(x25->calluserdata.cuddata, skb->data, | 115 | skb_copy_from_linear_data(skb, |
116 | skb->len); | 116 | x25->calluserdata.cuddata, |
117 | skb->len); | ||
117 | x25->calluserdata.cudlength = skb->len; | 118 | x25->calluserdata.cudlength = skb->len; |
118 | } | 119 | } |
119 | if (!sock_flag(sk, SOCK_DEAD)) | 120 | if (!sock_flag(sk, SOCK_DEAD)) |
diff --git a/net/x25/x25_out.c b/net/x25/x25_out.c index 6f5737853912..bb45e21ffce9 100644 --- a/net/x25/x25_out.c +++ b/net/x25/x25_out.c | |||
@@ -61,7 +61,7 @@ int x25_output(struct sock *sk, struct sk_buff *skb) | |||
61 | 61 | ||
62 | if (skb->len - header_len > max_len) { | 62 | if (skb->len - header_len > max_len) { |
63 | /* Save a copy of the Header */ | 63 | /* Save a copy of the Header */ |
64 | memcpy(header, skb->data, header_len); | 64 | skb_copy_from_linear_data(skb, header, header_len); |
65 | skb_pull(skb, header_len); | 65 | skb_pull(skb, header_len); |
66 | 66 | ||
67 | frontlen = skb_headroom(skb); | 67 | frontlen = skb_headroom(skb); |
@@ -84,7 +84,7 @@ int x25_output(struct sock *sk, struct sk_buff *skb) | |||
84 | len = max_len > skb->len ? skb->len : max_len; | 84 | len = max_len > skb->len ? skb->len : max_len; |
85 | 85 | ||
86 | /* Copy the user data */ | 86 | /* Copy the user data */ |
87 | memcpy(skb_put(skbn, len), skb->data, len); | 87 | skb_copy_from_linear_data(skb, skb_put(skbn, len), len); |
88 | skb_pull(skb, len); | 88 | skb_pull(skb, len); |
89 | 89 | ||
90 | /* Duplicate the Header */ | 90 | /* Duplicate the Header */ |