This patch drops the direct memcpy on skb and uses the right skb
memcpy functions. Also remove an unnecessary check if plen is non zero.

Signed-off-by: Alexander Aring <alex.ar...@gmail.com>
Reviewed-by: Werner Almesberger <wer...@almesberger.net>
---
 net/ieee802154/6lowpan.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index 58c07fd..9497c6f 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
@@ -1122,12 +1122,15 @@ lowpan_fragment_xmit(struct sk_buff *skb, u8 *head,
        frag->priority = skb->priority;
 
        /* copy header, MFR and payload */
-       memcpy(skb_put(frag, mlen), skb->data, mlen);
-       memcpy(skb_put(frag, hlen), head, hlen);
+       skb_put(frag, mlen);
+       skb_copy_to_linear_data(frag, skb_mac_header(skb), mlen);
 
-       if (plen)
-               skb_copy_from_linear_data_offset(skb, offset + mlen,
-                                       skb_put(frag, plen), plen);
+       skb_put(frag, hlen);
+       skb_copy_to_linear_data_offset(frag, mlen, head, hlen);
+
+       skb_put(frag, plen);
+       skb_copy_to_linear_data_offset(frag, mlen + hlen,
+                                      skb_network_header(skb) + offset, plen);
 
        lowpan_raw_dump_table(__func__, " raw fragment dump", frag->data,
                                                                frag->len);
-- 
1.8.4.2


------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel

Reply via email to