]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ieee802154: 6lowpan: change datagram var types
authorAlexander Aring <alex.aring@gmail.com>
Wed, 30 Sep 2015 08:20:09 +0000 (10:20 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 30 Sep 2015 11:23:57 +0000 (13:23 +0200)
This patch changes datagram size variable from u16 type to unsigned int.
The reason is that an IPv6 header has an MAX_UIN16 payload length, but
the datagram size is payload + IPv6 header length. This avoids overflows
at some places.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/ieee802154/6lowpan/6lowpan_i.h
net/ieee802154/6lowpan/reassembly.c
net/ieee802154/6lowpan/tx.c

index b4e17a7c0df0838f7aed6ac4fa4705a70699a7a8..10d44d08a4406b649f4bb24bee4d715076a6dcb1 100644 (file)
@@ -18,7 +18,7 @@ typedef unsigned __bitwise__ lowpan_rx_result;
 
 struct lowpan_create_arg {
        u16 tag;
-       u16 d_size;
+       unsigned int d_size;
        const struct ieee802154_addr *src;
        const struct ieee802154_addr *dst;
 };
@@ -29,7 +29,7 @@ struct lowpan_frag_queue {
        struct inet_frag_queue  q;
 
        u16                     tag;
-       u16                     d_size;
+       unsigned int            d_size;
        struct ieee802154_addr  saddr;
        struct ieee802154_addr  daddr;
 };
index 12e8cf4bda9ff9e6b9f7744635bf159421ae8a5c..af663cb74f1f61751eae71945ccc6ab78c355924 100644 (file)
@@ -37,7 +37,7 @@ static struct inet_frags lowpan_frags;
 static int lowpan_frag_reasm(struct lowpan_frag_queue *fq,
                             struct sk_buff *prev, struct net_device *ldev);
 
-static unsigned int lowpan_hash_frag(u16 tag, u16 d_size,
+static unsigned int lowpan_hash_frag(u16 tag, unsigned int d_size,
                                     const struct ieee802154_addr *saddr,
                                     const struct ieee802154_addr *daddr)
 {
index 7e0563eaea98b2c45b3b5bc2556ff9a3d86c2ac8..5ecf8af7154bd0851aca76d49b867794f09ec1b1 100644 (file)
@@ -131,8 +131,8 @@ lowpan_xmit_fragment(struct sk_buff *skb, const struct ieee802154_hdr *wpan_hdr,
 
 static int
 lowpan_xmit_fragmented(struct sk_buff *skb, struct net_device *ldev,
-                      const struct ieee802154_hdr *wpan_hdr, u16 dgram_size,
-                      u16 dgram_offset)
+                      const struct ieee802154_hdr *wpan_hdr,
+                      unsigned int dgram_size, unsigned int dgram_offset)
 {
        __be16 frag_tag;
        u8 frag_hdr[5];
@@ -194,7 +194,7 @@ err:
 }
 
 static int lowpan_header(struct sk_buff *skb, struct net_device *ldev,
-                        u16 *dgram_size, u16 *dgram_offset)
+                        unsigned int *dgram_size, unsigned int *dgram_offset)
 {
        struct wpan_dev *wpan_dev = lowpan_dev_info(ldev)->wdev->ieee802154_ptr;
        struct ieee802154_addr sa, da;
@@ -244,7 +244,7 @@ netdev_tx_t lowpan_xmit(struct sk_buff *skb, struct net_device *ldev)
 {
        struct ieee802154_hdr wpan_hdr;
        int max_single, ret;
-       u16 dgram_size, dgram_offset;
+       unsigned int dgram_size, dgram_offset;
 
        pr_debug("package xmit\n");