Skip to content

Commit 4ebc960

Browse files
alexaringholtmann
authored andcommitted
6lowpan: iphc: cleanup use of lowpan_fetch_skb
We introduced the lowpan_fetch_skb function in some previous patches for 6lowpan to have a generic fetch function. This patch drops the old function and use the generic lowpan_fetch_skb one. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
1 parent 8ec1d9b commit 4ebc960

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

‎net/6lowpan/iphc.c‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ int lowpan_process_data(struct sk_buff *skb, struct net_device *dev,
357357
/* another if the CID flag is set */
358358
if (iphc1 & LOWPAN_IPHC_CID) {
359359
pr_debug("CID flag is set, increase header with one\n");
360-
if (lowpan_fetch_skb_u8(skb, &num_context))
360+
if (lowpan_fetch_skb(skb, &num_context, sizeof(num_context)))
361361
goto drop;
362362
}
363363

@@ -370,7 +370,7 @@ int lowpan_process_data(struct sk_buff *skb, struct net_device *dev,
370370
* ECN + DSCP + 4-bit Pad + Flow Label (4 bytes)
371371
*/
372372
case 0: /* 00b */
373-
if (lowpan_fetch_skb_u8(skb, &tmp))
373+
if (lowpan_fetch_skb(skb, &tmp, sizeof(tmp)))
374374
goto drop;
375375

376376
memcpy(&hdr.flow_lbl, &skb->data[0], 3);
@@ -384,7 +384,7 @@ int lowpan_process_data(struct sk_buff *skb, struct net_device *dev,
384384
* ECN + DSCP (1 byte), Flow Label is elided
385385
*/
386386
case 2: /* 10b */
387-
if (lowpan_fetch_skb_u8(skb, &tmp))
387+
if (lowpan_fetch_skb(skb, &tmp, sizeof(tmp)))
388388
goto drop;
389389

390390
hdr.priority = ((tmp >> 2) & 0x0f);
@@ -395,7 +395,7 @@ int lowpan_process_data(struct sk_buff *skb, struct net_device *dev,
395395
* ECN + 2-bit Pad + Flow Label (3 bytes), DSCP is elided
396396
*/
397397
case 1: /* 01b */
398-
if (lowpan_fetch_skb_u8(skb, &tmp))
398+
if (lowpan_fetch_skb(skb, &tmp, sizeof(tmp)))
399399
goto drop;
400400

401401
hdr.flow_lbl[0] = (skb->data[0] & 0x0F) | ((tmp >> 2) & 0x30);
@@ -412,7 +412,7 @@ int lowpan_process_data(struct sk_buff *skb, struct net_device *dev,
412412
/* Next Header */
413413
if ((iphc0 & LOWPAN_IPHC_NH_C) == 0) {
414414
/* Next header is carried inline */
415-
if (lowpan_fetch_skb_u8(skb, &(hdr.nexthdr)))
415+
if (lowpan_fetch_skb(skb, &hdr.nexthdr, sizeof(hdr.nexthdr)))
416416
goto drop;
417417

418418
pr_debug("NH flag is set, next header carried inline: %02x\n",
@@ -423,7 +423,8 @@ int lowpan_process_data(struct sk_buff *skb, struct net_device *dev,
423423
if ((iphc0 & 0x03) != LOWPAN_IPHC_TTL_I)
424424
hdr.hop_limit = lowpan_ttl_values[iphc0 & 0x03];
425425
else {
426-
if (lowpan_fetch_skb_u8(skb, &(hdr.hop_limit)))
426+
if (lowpan_fetch_skb(skb, &hdr.hop_limit,
427+
sizeof(hdr.hop_limit)))
427428
goto drop;
428429
}
429430

0 commit comments

Comments
 (0)