diff options
author | Alexander Aring <alex.aring@gmail.com> | 2014-07-29 17:46:59 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-07-30 13:28:39 -0400 |
commit | 8ec1d9be323388550b3eb4390c23217ea0711013 (patch) | |
tree | 036bec4cc5bb300df59de02968e8b742f415a00b /net/6lowpan | |
parent | 84ca5e036f41bb2d08accbd3cfd293f0bd955573 (diff) |
6lowpan: iphc: use sizeof in udp uncompression
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/6lowpan')
-rw-r--r-- | net/6lowpan/iphc.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/net/6lowpan/iphc.c b/net/6lowpan/iphc.c index a13eae52e590..d2654d46e0c1 100644 --- a/net/6lowpan/iphc.c +++ b/net/6lowpan/iphc.c | |||
@@ -271,27 +271,31 @@ uncompress_udp_header(struct sk_buff *skb, struct udphdr *uh) | |||
271 | if (!uh) | 271 | if (!uh) |
272 | goto err; | 272 | goto err; |
273 | 273 | ||
274 | fail = lowpan_fetch_skb(skb, &tmp, 1); | 274 | fail = lowpan_fetch_skb(skb, &tmp, sizeof(tmp)); |
275 | 275 | ||
276 | if ((tmp & LOWPAN_NHC_UDP_MASK) == LOWPAN_NHC_UDP_ID) { | 276 | if ((tmp & LOWPAN_NHC_UDP_MASK) == LOWPAN_NHC_UDP_ID) { |
277 | pr_debug("UDP header uncompression\n"); | 277 | pr_debug("UDP header uncompression\n"); |
278 | switch (tmp & LOWPAN_NHC_UDP_CS_P_11) { | 278 | switch (tmp & LOWPAN_NHC_UDP_CS_P_11) { |
279 | case LOWPAN_NHC_UDP_CS_P_00: | 279 | case LOWPAN_NHC_UDP_CS_P_00: |
280 | fail |= lowpan_fetch_skb(skb, &uh->source, 2); | 280 | fail |= lowpan_fetch_skb(skb, &uh->source, |
281 | fail |= lowpan_fetch_skb(skb, &uh->dest, 2); | 281 | sizeof(uh->source)); |
282 | fail |= lowpan_fetch_skb(skb, &uh->dest, | ||
283 | sizeof(uh->dest)); | ||
282 | break; | 284 | break; |
283 | case LOWPAN_NHC_UDP_CS_P_01: | 285 | case LOWPAN_NHC_UDP_CS_P_01: |
284 | fail |= lowpan_fetch_skb(skb, &uh->source, 2); | 286 | fail |= lowpan_fetch_skb(skb, &uh->source, |
285 | fail |= lowpan_fetch_skb(skb, &val, 1); | 287 | sizeof(uh->source)); |
288 | fail |= lowpan_fetch_skb(skb, &val, sizeof(val)); | ||
286 | uh->dest = htons(val + LOWPAN_NHC_UDP_8BIT_PORT); | 289 | uh->dest = htons(val + LOWPAN_NHC_UDP_8BIT_PORT); |
287 | break; | 290 | break; |
288 | case LOWPAN_NHC_UDP_CS_P_10: | 291 | case LOWPAN_NHC_UDP_CS_P_10: |
289 | fail |= lowpan_fetch_skb(skb, &val, 1); | 292 | fail |= lowpan_fetch_skb(skb, &val, sizeof(val)); |
290 | uh->source = htons(val + LOWPAN_NHC_UDP_8BIT_PORT); | 293 | uh->source = htons(val + LOWPAN_NHC_UDP_8BIT_PORT); |
291 | fail |= lowpan_fetch_skb(skb, &uh->dest, 2); | 294 | fail |= lowpan_fetch_skb(skb, &uh->dest, |
295 | sizeof(uh->dest)); | ||
292 | break; | 296 | break; |
293 | case LOWPAN_NHC_UDP_CS_P_11: | 297 | case LOWPAN_NHC_UDP_CS_P_11: |
294 | fail |= lowpan_fetch_skb(skb, &val, 1); | 298 | fail |= lowpan_fetch_skb(skb, &val, sizeof(val)); |
295 | uh->source = htons(LOWPAN_NHC_UDP_4BIT_PORT + | 299 | uh->source = htons(LOWPAN_NHC_UDP_4BIT_PORT + |
296 | (val >> 4)); | 300 | (val >> 4)); |
297 | uh->dest = htons(LOWPAN_NHC_UDP_4BIT_PORT + | 301 | uh->dest = htons(LOWPAN_NHC_UDP_4BIT_PORT + |
@@ -311,7 +315,8 @@ uncompress_udp_header(struct sk_buff *skb, struct udphdr *uh) | |||
311 | pr_debug_ratelimited("checksum elided currently not supported\n"); | 315 | pr_debug_ratelimited("checksum elided currently not supported\n"); |
312 | goto err; | 316 | goto err; |
313 | } else { | 317 | } else { |
314 | fail |= lowpan_fetch_skb(skb, &uh->check, 2); | 318 | fail |= lowpan_fetch_skb(skb, &uh->check, |
319 | sizeof(uh->check)); | ||
315 | } | 320 | } |
316 | 321 | ||
317 | /* | 322 | /* |