diff options
Diffstat (limited to 'net/tipc/link.c')
-rw-r--r-- | net/tipc/link.c | 46 |
1 files changed, 24 insertions, 22 deletions
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? */ |