diff options
Diffstat (limited to 'net/sched/ematch.c')
-rw-r--r-- | net/sched/ematch.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/net/sched/ematch.c b/net/sched/ematch.c index 959c306c5714..63146d339d81 100644 --- a/net/sched/ematch.c +++ b/net/sched/ematch.c | |||
@@ -418,17 +418,19 @@ void tcf_em_tree_destroy(struct tcf_proto *tp, struct tcf_ematch_tree *tree) | |||
418 | int tcf_em_tree_dump(struct sk_buff *skb, struct tcf_ematch_tree *tree, int tlv) | 418 | int tcf_em_tree_dump(struct sk_buff *skb, struct tcf_ematch_tree *tree, int tlv) |
419 | { | 419 | { |
420 | int i; | 420 | int i; |
421 | struct rtattr * top_start = (struct rtattr*) skb->tail; | 421 | u8 *tail; |
422 | struct rtattr * list_start; | 422 | struct rtattr *top_start = (struct rtattr *)skb_tail_pointer(skb); |
423 | struct rtattr *list_start; | ||
423 | 424 | ||
424 | RTA_PUT(skb, tlv, 0, NULL); | 425 | RTA_PUT(skb, tlv, 0, NULL); |
425 | RTA_PUT(skb, TCA_EMATCH_TREE_HDR, sizeof(tree->hdr), &tree->hdr); | 426 | RTA_PUT(skb, TCA_EMATCH_TREE_HDR, sizeof(tree->hdr), &tree->hdr); |
426 | 427 | ||
427 | list_start = (struct rtattr *) skb->tail; | 428 | list_start = (struct rtattr *)skb_tail_pointer(skb); |
428 | RTA_PUT(skb, TCA_EMATCH_TREE_LIST, 0, NULL); | 429 | RTA_PUT(skb, TCA_EMATCH_TREE_LIST, 0, NULL); |
429 | 430 | ||
431 | tail = skb_tail_pointer(skb); | ||
430 | for (i = 0; i < tree->hdr.nmatches; i++) { | 432 | for (i = 0; i < tree->hdr.nmatches; i++) { |
431 | struct rtattr *match_start = (struct rtattr*) skb->tail; | 433 | struct rtattr *match_start = (struct rtattr *)tail; |
432 | struct tcf_ematch *em = tcf_em_get_match(tree, i); | 434 | struct tcf_ematch *em = tcf_em_get_match(tree, i); |
433 | struct tcf_ematch_hdr em_hdr = { | 435 | struct tcf_ematch_hdr em_hdr = { |
434 | .kind = em->ops ? em->ops->kind : TCF_EM_CONTAINER, | 436 | .kind = em->ops ? em->ops->kind : TCF_EM_CONTAINER, |
@@ -447,11 +449,12 @@ int tcf_em_tree_dump(struct sk_buff *skb, struct tcf_ematch_tree *tree, int tlv) | |||
447 | } else if (em->datalen > 0) | 449 | } else if (em->datalen > 0) |
448 | RTA_PUT_NOHDR(skb, em->datalen, (void *) em->data); | 450 | RTA_PUT_NOHDR(skb, em->datalen, (void *) em->data); |
449 | 451 | ||
450 | match_start->rta_len = skb->tail - (u8*) match_start; | 452 | tail = skb_tail_pointer(skb); |
453 | match_start->rta_len = tail - (u8 *)match_start; | ||
451 | } | 454 | } |
452 | 455 | ||
453 | list_start->rta_len = skb->tail - (u8 *) list_start; | 456 | list_start->rta_len = tail - (u8 *)list_start; |
454 | top_start->rta_len = skb->tail - (u8 *) top_start; | 457 | top_start->rta_len = tail - (u8 *)top_start; |
455 | 458 | ||
456 | return 0; | 459 | return 0; |
457 | 460 | ||