aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched
diff options
context:
space:
mode:
Diffstat (limited to 'net/sched')
-rw-r--r--net/sched/act_api.c52
-rw-r--r--net/sched/act_gact.c2
-rw-r--r--net/sched/act_ipt.c2
-rw-r--r--net/sched/act_mirred.c2
-rw-r--r--net/sched/act_pedit.c2
-rw-r--r--net/sched/act_police.c8
-rw-r--r--net/sched/act_simple.c2
-rw-r--r--net/sched/cls_api.c14
-rw-r--r--net/sched/cls_basic.c4
-rw-r--r--net/sched/cls_fw.c4
-rw-r--r--net/sched/cls_route.c4
-rw-r--r--net/sched/cls_rsvp.h4
-rw-r--r--net/sched/cls_tcindex.c6
-rw-r--r--net/sched/cls_u32.c6
-rw-r--r--net/sched/ematch.c17
-rw-r--r--net/sched/sch_api.c8
-rw-r--r--net/sched/sch_atm.c4
-rw-r--r--net/sched/sch_cbq.c20
-rw-r--r--net/sched/sch_hfsc.c6
-rw-r--r--net/sched/sch_htb.c10
-rw-r--r--net/sched/sch_ingress.c4
-rw-r--r--net/sched/sch_netem.c4
-rw-r--r--net/sched/sch_prio.c2
-rw-r--r--net/sched/sch_sfq.c2
-rw-r--r--net/sched/sch_tbf.c4
25 files changed, 98 insertions, 95 deletions
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index cb21617a5670..28326fb1fc4e 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -93,7 +93,7 @@ static int tcf_dump_walker(struct sk_buff *skb, struct netlink_callback *cb,
93 continue; 93 continue;
94 a->priv = p; 94 a->priv = p;
95 a->order = n_i; 95 a->order = n_i;
96 r = (struct rtattr*) skb->tail; 96 r = (struct rtattr *)skb_tail_pointer(skb);
97 RTA_PUT(skb, a->order, 0, NULL); 97 RTA_PUT(skb, a->order, 0, NULL);
98 err = tcf_action_dump_1(skb, a, 0, 0); 98 err = tcf_action_dump_1(skb, a, 0, 0);
99 if (err < 0) { 99 if (err < 0) {
@@ -101,7 +101,7 @@ static int tcf_dump_walker(struct sk_buff *skb, struct netlink_callback *cb,
101 skb_trim(skb, (u8*)r - skb->data); 101 skb_trim(skb, (u8*)r - skb->data);
102 goto done; 102 goto done;
103 } 103 }
104 r->rta_len = skb->tail - (u8*)r; 104 r->rta_len = skb_tail_pointer(skb) - (u8 *)r;
105 n_i++; 105 n_i++;
106 if (n_i >= TCA_ACT_MAX_PRIO) 106 if (n_i >= TCA_ACT_MAX_PRIO)
107 goto done; 107 goto done;
@@ -125,7 +125,7 @@ static int tcf_del_walker(struct sk_buff *skb, struct tc_action *a,
125 struct rtattr *r ; 125 struct rtattr *r ;
126 int i= 0, n_i = 0; 126 int i= 0, n_i = 0;
127 127
128 r = (struct rtattr*) skb->tail; 128 r = (struct rtattr *)skb_tail_pointer(skb);
129 RTA_PUT(skb, a->order, 0, NULL); 129 RTA_PUT(skb, a->order, 0, NULL);
130 RTA_PUT(skb, TCA_KIND, IFNAMSIZ, a->ops->kind); 130 RTA_PUT(skb, TCA_KIND, IFNAMSIZ, a->ops->kind);
131 for (i = 0; i < (hinfo->hmask + 1); i++) { 131 for (i = 0; i < (hinfo->hmask + 1); i++) {
@@ -140,7 +140,7 @@ static int tcf_del_walker(struct sk_buff *skb, struct tc_action *a,
140 } 140 }
141 } 141 }
142 RTA_PUT(skb, TCA_FCNT, 4, &n_i); 142 RTA_PUT(skb, TCA_FCNT, 4, &n_i);
143 r->rta_len = skb->tail - (u8*)r; 143 r->rta_len = skb_tail_pointer(skb) - (u8 *)r;
144 144
145 return n_i; 145 return n_i;
146rtattr_failure: 146rtattr_failure:
@@ -423,7 +423,7 @@ int
423tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int bind, int ref) 423tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
424{ 424{
425 int err = -EINVAL; 425 int err = -EINVAL;
426 unsigned char *b = skb->tail; 426 unsigned char *b = skb_tail_pointer(skb);
427 struct rtattr *r; 427 struct rtattr *r;
428 428
429 if (a->ops == NULL || a->ops->dump == NULL) 429 if (a->ops == NULL || a->ops->dump == NULL)
@@ -432,10 +432,10 @@ tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
432 RTA_PUT(skb, TCA_KIND, IFNAMSIZ, a->ops->kind); 432 RTA_PUT(skb, TCA_KIND, IFNAMSIZ, a->ops->kind);
433 if (tcf_action_copy_stats(skb, a, 0)) 433 if (tcf_action_copy_stats(skb, a, 0))
434 goto rtattr_failure; 434 goto rtattr_failure;
435 r = (struct rtattr*) skb->tail; 435 r = (struct rtattr *)skb_tail_pointer(skb);
436 RTA_PUT(skb, TCA_OPTIONS, 0, NULL); 436 RTA_PUT(skb, TCA_OPTIONS, 0, NULL);
437 if ((err = tcf_action_dump_old(skb, a, bind, ref)) > 0) { 437 if ((err = tcf_action_dump_old(skb, a, bind, ref)) > 0) {
438 r->rta_len = skb->tail - (u8*)r; 438 r->rta_len = skb_tail_pointer(skb) - (u8 *)r;
439 return err; 439 return err;
440 } 440 }
441 441
@@ -449,17 +449,17 @@ tcf_action_dump(struct sk_buff *skb, struct tc_action *act, int bind, int ref)
449{ 449{
450 struct tc_action *a; 450 struct tc_action *a;
451 int err = -EINVAL; 451 int err = -EINVAL;
452 unsigned char *b = skb->tail; 452 unsigned char *b = skb_tail_pointer(skb);
453 struct rtattr *r ; 453 struct rtattr *r ;
454 454
455 while ((a = act) != NULL) { 455 while ((a = act) != NULL) {
456 r = (struct rtattr*) skb->tail; 456 r = (struct rtattr *)skb_tail_pointer(skb);
457 act = a->next; 457 act = a->next;
458 RTA_PUT(skb, a->order, 0, NULL); 458 RTA_PUT(skb, a->order, 0, NULL);
459 err = tcf_action_dump_1(skb, a, bind, ref); 459 err = tcf_action_dump_1(skb, a, bind, ref);
460 if (err < 0) 460 if (err < 0)
461 goto errout; 461 goto errout;
462 r->rta_len = skb->tail - (u8*)r; 462 r->rta_len = skb_tail_pointer(skb) - (u8 *)r;
463 } 463 }
464 464
465 return 0; 465 return 0;
@@ -635,7 +635,7 @@ tca_get_fill(struct sk_buff *skb, struct tc_action *a, u32 pid, u32 seq,
635{ 635{
636 struct tcamsg *t; 636 struct tcamsg *t;
637 struct nlmsghdr *nlh; 637 struct nlmsghdr *nlh;
638 unsigned char *b = skb->tail; 638 unsigned char *b = skb_tail_pointer(skb);
639 struct rtattr *x; 639 struct rtattr *x;
640 640
641 nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*t), flags); 641 nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*t), flags);
@@ -645,15 +645,15 @@ tca_get_fill(struct sk_buff *skb, struct tc_action *a, u32 pid, u32 seq,
645 t->tca__pad1 = 0; 645 t->tca__pad1 = 0;
646 t->tca__pad2 = 0; 646 t->tca__pad2 = 0;
647 647
648 x = (struct rtattr*) skb->tail; 648 x = (struct rtattr *)skb_tail_pointer(skb);
649 RTA_PUT(skb, TCA_ACT_TAB, 0, NULL); 649 RTA_PUT(skb, TCA_ACT_TAB, 0, NULL);
650 650
651 if (tcf_action_dump(skb, a, bind, ref) < 0) 651 if (tcf_action_dump(skb, a, bind, ref) < 0)
652 goto rtattr_failure; 652 goto rtattr_failure;
653 653
654 x->rta_len = skb->tail - (u8*)x; 654 x->rta_len = skb_tail_pointer(skb) - (u8 *)x;
655 655
656 nlh->nlmsg_len = skb->tail - b; 656 nlh->nlmsg_len = skb_tail_pointer(skb) - b;
657 return skb->len; 657 return skb->len;
658 658
659rtattr_failure: 659rtattr_failure:
@@ -767,7 +767,7 @@ static int tca_action_flush(struct rtattr *rta, struct nlmsghdr *n, u32 pid)
767 return -ENOBUFS; 767 return -ENOBUFS;
768 } 768 }
769 769
770 b = (unsigned char *)skb->tail; 770 b = skb_tail_pointer(skb);
771 771
772 if (rtattr_parse_nested(tb, TCA_ACT_MAX, rta) < 0) 772 if (rtattr_parse_nested(tb, TCA_ACT_MAX, rta) < 0)
773 goto err_out; 773 goto err_out;
@@ -783,16 +783,16 @@ static int tca_action_flush(struct rtattr *rta, struct nlmsghdr *n, u32 pid)
783 t->tca__pad1 = 0; 783 t->tca__pad1 = 0;
784 t->tca__pad2 = 0; 784 t->tca__pad2 = 0;
785 785
786 x = (struct rtattr *) skb->tail; 786 x = (struct rtattr *)skb_tail_pointer(skb);
787 RTA_PUT(skb, TCA_ACT_TAB, 0, NULL); 787 RTA_PUT(skb, TCA_ACT_TAB, 0, NULL);
788 788
789 err = a->ops->walk(skb, &dcb, RTM_DELACTION, a); 789 err = a->ops->walk(skb, &dcb, RTM_DELACTION, a);
790 if (err < 0) 790 if (err < 0)
791 goto rtattr_failure; 791 goto rtattr_failure;
792 792
793 x->rta_len = skb->tail - (u8 *) x; 793 x->rta_len = skb_tail_pointer(skb) - (u8 *)x;
794 794
795 nlh->nlmsg_len = skb->tail - b; 795 nlh->nlmsg_len = skb_tail_pointer(skb) - b;
796 nlh->nlmsg_flags |= NLM_F_ROOT; 796 nlh->nlmsg_flags |= NLM_F_ROOT;
797 module_put(a->ops->owner); 797 module_put(a->ops->owner);
798 kfree(a); 798 kfree(a);
@@ -884,7 +884,7 @@ static int tcf_add_notify(struct tc_action *a, u32 pid, u32 seq, int event,
884 if (!skb) 884 if (!skb)
885 return -ENOBUFS; 885 return -ENOBUFS;
886 886
887 b = (unsigned char *)skb->tail; 887 b = skb_tail_pointer(skb);
888 888
889 nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*t), flags); 889 nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*t), flags);
890 t = NLMSG_DATA(nlh); 890 t = NLMSG_DATA(nlh);
@@ -892,15 +892,15 @@ static int tcf_add_notify(struct tc_action *a, u32 pid, u32 seq, int event,
892 t->tca__pad1 = 0; 892 t->tca__pad1 = 0;
893 t->tca__pad2 = 0; 893 t->tca__pad2 = 0;
894 894
895 x = (struct rtattr*) skb->tail; 895 x = (struct rtattr *)skb_tail_pointer(skb);
896 RTA_PUT(skb, TCA_ACT_TAB, 0, NULL); 896 RTA_PUT(skb, TCA_ACT_TAB, 0, NULL);
897 897
898 if (tcf_action_dump(skb, a, 0, 0) < 0) 898 if (tcf_action_dump(skb, a, 0, 0) < 0)
899 goto rtattr_failure; 899 goto rtattr_failure;
900 900
901 x->rta_len = skb->tail - (u8*)x; 901 x->rta_len = skb_tail_pointer(skb) - (u8 *)x;
902 902
903 nlh->nlmsg_len = skb->tail - b; 903 nlh->nlmsg_len = skb_tail_pointer(skb) - b;
904 NETLINK_CB(skb).dst_group = RTNLGRP_TC; 904 NETLINK_CB(skb).dst_group = RTNLGRP_TC;
905 905
906 err = rtnetlink_send(skb, pid, RTNLGRP_TC, flags&NLM_F_ECHO); 906 err = rtnetlink_send(skb, pid, RTNLGRP_TC, flags&NLM_F_ECHO);
@@ -1015,7 +1015,7 @@ static int
1015tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb) 1015tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb)
1016{ 1016{
1017 struct nlmsghdr *nlh; 1017 struct nlmsghdr *nlh;
1018 unsigned char *b = skb->tail; 1018 unsigned char *b = skb_tail_pointer(skb);
1019 struct rtattr *x; 1019 struct rtattr *x;
1020 struct tc_action_ops *a_o; 1020 struct tc_action_ops *a_o;
1021 struct tc_action a; 1021 struct tc_action a;
@@ -1048,7 +1048,7 @@ tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb)
1048 t->tca__pad1 = 0; 1048 t->tca__pad1 = 0;
1049 t->tca__pad2 = 0; 1049 t->tca__pad2 = 0;
1050 1050
1051 x = (struct rtattr *) skb->tail; 1051 x = (struct rtattr *)skb_tail_pointer(skb);
1052 RTA_PUT(skb, TCA_ACT_TAB, 0, NULL); 1052 RTA_PUT(skb, TCA_ACT_TAB, 0, NULL);
1053 1053
1054 ret = a_o->walk(skb, cb, RTM_GETACTION, &a); 1054 ret = a_o->walk(skb, cb, RTM_GETACTION, &a);
@@ -1056,12 +1056,12 @@ tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb)
1056 goto rtattr_failure; 1056 goto rtattr_failure;
1057 1057
1058 if (ret > 0) { 1058 if (ret > 0) {
1059 x->rta_len = skb->tail - (u8 *) x; 1059 x->rta_len = skb_tail_pointer(skb) - (u8 *)x;
1060 ret = skb->len; 1060 ret = skb->len;
1061 } else 1061 } else
1062 skb_trim(skb, (u8*)x - skb->data); 1062 skb_trim(skb, (u8*)x - skb->data);
1063 1063
1064 nlh->nlmsg_len = skb->tail - b; 1064 nlh->nlmsg_len = skb_tail_pointer(skb) - b;
1065 if (NETLINK_CB(cb->skb).pid && ret) 1065 if (NETLINK_CB(cb->skb).pid && ret)
1066 nlh->nlmsg_flags |= NLM_F_MULTI; 1066 nlh->nlmsg_flags |= NLM_F_MULTI;
1067 module_put(a_o->owner); 1067 module_put(a_o->owner);
diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c
index 87d0faf32867..aad748b3b38c 100644
--- a/net/sched/act_gact.c
+++ b/net/sched/act_gact.c
@@ -155,7 +155,7 @@ static int tcf_gact(struct sk_buff *skb, struct tc_action *a, struct tcf_result
155 155
156static int tcf_gact_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) 156static int tcf_gact_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
157{ 157{
158 unsigned char *b = skb->tail; 158 unsigned char *b = skb_tail_pointer(skb);
159 struct tc_gact opt; 159 struct tc_gact opt;
160 struct tcf_gact *gact = a->priv; 160 struct tcf_gact *gact = a->priv;
161 struct tcf_t t; 161 struct tcf_t t;
diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c
index 47f0b1324239..2ccfd5b20fab 100644
--- a/net/sched/act_ipt.c
+++ b/net/sched/act_ipt.c
@@ -245,7 +245,7 @@ static int tcf_ipt(struct sk_buff *skb, struct tc_action *a,
245 245
246static int tcf_ipt_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) 246static int tcf_ipt_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
247{ 247{
248 unsigned char *b = skb->tail; 248 unsigned char *b = skb_tail_pointer(skb);
249 struct tcf_ipt *ipt = a->priv; 249 struct tcf_ipt *ipt = a->priv;
250 struct ipt_entry_target *t; 250 struct ipt_entry_target *t;
251 struct tcf_t tm; 251 struct tcf_t tm;
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
index 3e93683e9ab3..15f6ecdaf611 100644
--- a/net/sched/act_mirred.c
+++ b/net/sched/act_mirred.c
@@ -206,7 +206,7 @@ bad_mirred:
206 206
207static int tcf_mirred_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) 207static int tcf_mirred_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
208{ 208{
209 unsigned char *b = skb->tail; 209 unsigned char *b = skb_tail_pointer(skb);
210 struct tcf_mirred *m = a->priv; 210 struct tcf_mirred *m = a->priv;
211 struct tc_mirred opt; 211 struct tc_mirred opt;
212 struct tcf_t t; 212 struct tcf_t t;
diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c
index 20813eee8af4..d654cea1a46c 100644
--- a/net/sched/act_pedit.c
+++ b/net/sched/act_pedit.c
@@ -195,7 +195,7 @@ done:
195static int tcf_pedit_dump(struct sk_buff *skb, struct tc_action *a, 195static int tcf_pedit_dump(struct sk_buff *skb, struct tc_action *a,
196 int bind, int ref) 196 int bind, int ref)
197{ 197{
198 unsigned char *b = skb->tail; 198 unsigned char *b = skb_tail_pointer(skb);
199 struct tcf_pedit *p = a->priv; 199 struct tcf_pedit *p = a->priv;
200 struct tc_pedit *opt; 200 struct tc_pedit *opt;
201 struct tcf_t t; 201 struct tcf_t t;
diff --git a/net/sched/act_police.c b/net/sched/act_police.c
index 10a5a5c36f76..068b23763665 100644
--- a/net/sched/act_police.c
+++ b/net/sched/act_police.c
@@ -80,7 +80,7 @@ static int tcf_act_police_walker(struct sk_buff *skb, struct netlink_callback *c
80 continue; 80 continue;
81 a->priv = p; 81 a->priv = p;
82 a->order = index; 82 a->order = index;
83 r = (struct rtattr*) skb->tail; 83 r = (struct rtattr *)skb_tail_pointer(skb);
84 RTA_PUT(skb, a->order, 0, NULL); 84 RTA_PUT(skb, a->order, 0, NULL);
85 if (type == RTM_DELACTION) 85 if (type == RTM_DELACTION)
86 err = tcf_action_dump_1(skb, a, 0, 1); 86 err = tcf_action_dump_1(skb, a, 0, 1);
@@ -91,7 +91,7 @@ static int tcf_act_police_walker(struct sk_buff *skb, struct netlink_callback *c
91 skb_trim(skb, (u8*)r - skb->data); 91 skb_trim(skb, (u8*)r - skb->data);
92 goto done; 92 goto done;
93 } 93 }
94 r->rta_len = skb->tail - (u8*)r; 94 r->rta_len = skb_tail_pointer(skb) - (u8 *)r;
95 n_i++; 95 n_i++;
96 } 96 }
97 } 97 }
@@ -326,7 +326,7 @@ static int tcf_act_police(struct sk_buff *skb, struct tc_action *a,
326static int 326static int
327tcf_act_police_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) 327tcf_act_police_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
328{ 328{
329 unsigned char *b = skb->tail; 329 unsigned char *b = skb_tail_pointer(skb);
330 struct tcf_police *police = a->priv; 330 struct tcf_police *police = a->priv;
331 struct tc_police opt; 331 struct tc_police opt;
332 332
@@ -572,7 +572,7 @@ EXPORT_SYMBOL(tcf_police);
572 572
573int tcf_police_dump(struct sk_buff *skb, struct tcf_police *police) 573int tcf_police_dump(struct sk_buff *skb, struct tcf_police *police)
574{ 574{
575 unsigned char *b = skb->tail; 575 unsigned char *b = skb_tail_pointer(skb);
576 struct tc_police opt; 576 struct tc_police opt;
577 577
578 opt.index = police->tcf_index; 578 opt.index = police->tcf_index;
diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c
index c7971182af07..ecbcfa59b76c 100644
--- a/net/sched/act_simple.c
+++ b/net/sched/act_simple.c
@@ -155,7 +155,7 @@ static inline int tcf_simp_cleanup(struct tc_action *a, int bind)
155static inline int tcf_simp_dump(struct sk_buff *skb, struct tc_action *a, 155static inline int tcf_simp_dump(struct sk_buff *skb, struct tc_action *a,
156 int bind, int ref) 156 int bind, int ref)
157{ 157{
158 unsigned char *b = skb->tail; 158 unsigned char *b = skb_tail_pointer(skb);
159 struct tcf_defact *d = a->priv; 159 struct tcf_defact *d = a->priv;
160 struct tc_defact opt; 160 struct tc_defact opt;
161 struct tcf_t t; 161 struct tcf_t t;
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 5c6ffdb77d2d..84231baf77d1 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -323,7 +323,7 @@ tcf_fill_node(struct sk_buff *skb, struct tcf_proto *tp, unsigned long fh,
323{ 323{
324 struct tcmsg *tcm; 324 struct tcmsg *tcm;
325 struct nlmsghdr *nlh; 325 struct nlmsghdr *nlh;
326 unsigned char *b = skb->tail; 326 unsigned char *b = skb_tail_pointer(skb);
327 327
328 nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*tcm), flags); 328 nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*tcm), flags);
329 tcm = NLMSG_DATA(nlh); 329 tcm = NLMSG_DATA(nlh);
@@ -340,7 +340,7 @@ tcf_fill_node(struct sk_buff *skb, struct tcf_proto *tp, unsigned long fh,
340 if (tp->ops->dump && tp->ops->dump(tp, fh, skb, tcm) < 0) 340 if (tp->ops->dump && tp->ops->dump(tp, fh, skb, tcm) < 0)
341 goto rtattr_failure; 341 goto rtattr_failure;
342 } 342 }
343 nlh->nlmsg_len = skb->tail - b; 343 nlh->nlmsg_len = skb_tail_pointer(skb) - b;
344 return skb->len; 344 return skb->len;
345 345
346nlmsg_failure: 346nlmsg_failure:
@@ -563,30 +563,30 @@ tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts,
563 * to work with both old and new modes of entering 563 * to work with both old and new modes of entering
564 * tc data even if iproute2 was newer - jhs 564 * tc data even if iproute2 was newer - jhs
565 */ 565 */
566 struct rtattr * p_rta = (struct rtattr*) skb->tail; 566 struct rtattr *p_rta = (struct rtattr *)skb_tail_pointer(skb);
567 567
568 if (exts->action->type != TCA_OLD_COMPAT) { 568 if (exts->action->type != TCA_OLD_COMPAT) {
569 RTA_PUT(skb, map->action, 0, NULL); 569 RTA_PUT(skb, map->action, 0, NULL);
570 if (tcf_action_dump(skb, exts->action, 0, 0) < 0) 570 if (tcf_action_dump(skb, exts->action, 0, 0) < 0)
571 goto rtattr_failure; 571 goto rtattr_failure;
572 p_rta->rta_len = skb->tail - (u8*)p_rta; 572 p_rta->rta_len = skb_tail_pointer(skb) - (u8 *)p_rta;
573 } else if (map->police) { 573 } else if (map->police) {
574 RTA_PUT(skb, map->police, 0, NULL); 574 RTA_PUT(skb, map->police, 0, NULL);
575 if (tcf_action_dump_old(skb, exts->action, 0, 0) < 0) 575 if (tcf_action_dump_old(skb, exts->action, 0, 0) < 0)
576 goto rtattr_failure; 576 goto rtattr_failure;
577 p_rta->rta_len = skb->tail - (u8*)p_rta; 577 p_rta->rta_len = skb_tail_pointer(skb) - (u8 *)p_rta;
578 } 578 }
579 } 579 }
580#elif defined CONFIG_NET_CLS_POLICE 580#elif defined CONFIG_NET_CLS_POLICE
581 if (map->police && exts->police) { 581 if (map->police && exts->police) {
582 struct rtattr * p_rta = (struct rtattr*) skb->tail; 582 struct rtattr *p_rta = (struct rtattr *)skb_tail_pointer(skb);
583 583
584 RTA_PUT(skb, map->police, 0, NULL); 584 RTA_PUT(skb, map->police, 0, NULL);
585 585
586 if (tcf_police_dump(skb, exts->police) < 0) 586 if (tcf_police_dump(skb, exts->police) < 0)
587 goto rtattr_failure; 587 goto rtattr_failure;
588 588
589 p_rta->rta_len = skb->tail - (u8*)p_rta; 589 p_rta->rta_len = skb_tail_pointer(skb) - (u8 *)p_rta;
590 } 590 }
591#endif 591#endif
592 return 0; 592 return 0;
diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c
index 4a91f082a81d..800ec2ac326b 100644
--- a/net/sched/cls_basic.c
+++ b/net/sched/cls_basic.c
@@ -245,7 +245,7 @@ static int basic_dump(struct tcf_proto *tp, unsigned long fh,
245 struct sk_buff *skb, struct tcmsg *t) 245 struct sk_buff *skb, struct tcmsg *t)
246{ 246{
247 struct basic_filter *f = (struct basic_filter *) fh; 247 struct basic_filter *f = (struct basic_filter *) fh;
248 unsigned char *b = skb->tail; 248 unsigned char *b = skb_tail_pointer(skb);
249 struct rtattr *rta; 249 struct rtattr *rta;
250 250
251 if (f == NULL) 251 if (f == NULL)
@@ -263,7 +263,7 @@ static int basic_dump(struct tcf_proto *tp, unsigned long fh,
263 tcf_em_tree_dump(skb, &f->ematches, TCA_BASIC_EMATCHES) < 0) 263 tcf_em_tree_dump(skb, &f->ematches, TCA_BASIC_EMATCHES) < 0)
264 goto rtattr_failure; 264 goto rtattr_failure;
265 265
266 rta->rta_len = (skb->tail - b); 266 rta->rta_len = skb_tail_pointer(skb) - b;
267 return skb->len; 267 return skb->len;
268 268
269rtattr_failure: 269rtattr_failure:
diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c
index 5dbb9d451f73..f5f355852a87 100644
--- a/net/sched/cls_fw.c
+++ b/net/sched/cls_fw.c
@@ -348,7 +348,7 @@ static int fw_dump(struct tcf_proto *tp, unsigned long fh,
348{ 348{
349 struct fw_head *head = (struct fw_head *)tp->root; 349 struct fw_head *head = (struct fw_head *)tp->root;
350 struct fw_filter *f = (struct fw_filter*)fh; 350 struct fw_filter *f = (struct fw_filter*)fh;
351 unsigned char *b = skb->tail; 351 unsigned char *b = skb_tail_pointer(skb);
352 struct rtattr *rta; 352 struct rtattr *rta;
353 353
354 if (f == NULL) 354 if (f == NULL)
@@ -374,7 +374,7 @@ static int fw_dump(struct tcf_proto *tp, unsigned long fh,
374 if (tcf_exts_dump(skb, &f->exts, &fw_ext_map) < 0) 374 if (tcf_exts_dump(skb, &f->exts, &fw_ext_map) < 0)
375 goto rtattr_failure; 375 goto rtattr_failure;
376 376
377 rta->rta_len = skb->tail - b; 377 rta->rta_len = skb_tail_pointer(skb) - b;
378 378
379 if (tcf_exts_dump_stats(skb, &f->exts, &fw_ext_map) < 0) 379 if (tcf_exts_dump_stats(skb, &f->exts, &fw_ext_map) < 0)
380 goto rtattr_failure; 380 goto rtattr_failure;
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c
index abc47cc48ad0..1f94df36239d 100644
--- a/net/sched/cls_route.c
+++ b/net/sched/cls_route.c
@@ -562,7 +562,7 @@ static int route4_dump(struct tcf_proto *tp, unsigned long fh,
562 struct sk_buff *skb, struct tcmsg *t) 562 struct sk_buff *skb, struct tcmsg *t)
563{ 563{
564 struct route4_filter *f = (struct route4_filter*)fh; 564 struct route4_filter *f = (struct route4_filter*)fh;
565 unsigned char *b = skb->tail; 565 unsigned char *b = skb_tail_pointer(skb);
566 struct rtattr *rta; 566 struct rtattr *rta;
567 u32 id; 567 u32 id;
568 568
@@ -591,7 +591,7 @@ static int route4_dump(struct tcf_proto *tp, unsigned long fh,
591 if (tcf_exts_dump(skb, &f->exts, &route_ext_map) < 0) 591 if (tcf_exts_dump(skb, &f->exts, &route_ext_map) < 0)
592 goto rtattr_failure; 592 goto rtattr_failure;
593 593
594 rta->rta_len = skb->tail - b; 594 rta->rta_len = skb_tail_pointer(skb) - b;
595 595
596 if (tcf_exts_dump_stats(skb, &f->exts, &route_ext_map) < 0) 596 if (tcf_exts_dump_stats(skb, &f->exts, &route_ext_map) < 0)
597 goto rtattr_failure; 597 goto rtattr_failure;
diff --git a/net/sched/cls_rsvp.h b/net/sched/cls_rsvp.h
index 6f373b020eb4..87ed6f3c5070 100644
--- a/net/sched/cls_rsvp.h
+++ b/net/sched/cls_rsvp.h
@@ -593,7 +593,7 @@ static int rsvp_dump(struct tcf_proto *tp, unsigned long fh,
593{ 593{
594 struct rsvp_filter *f = (struct rsvp_filter*)fh; 594 struct rsvp_filter *f = (struct rsvp_filter*)fh;
595 struct rsvp_session *s; 595 struct rsvp_session *s;
596 unsigned char *b = skb->tail; 596 unsigned char *b = skb_tail_pointer(skb);
597 struct rtattr *rta; 597 struct rtattr *rta;
598 struct tc_rsvp_pinfo pinfo; 598 struct tc_rsvp_pinfo pinfo;
599 599
@@ -623,7 +623,7 @@ static int rsvp_dump(struct tcf_proto *tp, unsigned long fh,
623 if (tcf_exts_dump(skb, &f->exts, &rsvp_ext_map) < 0) 623 if (tcf_exts_dump(skb, &f->exts, &rsvp_ext_map) < 0)
624 goto rtattr_failure; 624 goto rtattr_failure;
625 625
626 rta->rta_len = skb->tail - b; 626 rta->rta_len = skb_tail_pointer(skb) - b;
627 627
628 if (tcf_exts_dump_stats(skb, &f->exts, &rsvp_ext_map) < 0) 628 if (tcf_exts_dump_stats(skb, &f->exts, &rsvp_ext_map) < 0)
629 goto rtattr_failure; 629 goto rtattr_failure;
diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c
index 7563fdcef4b7..0537d6066b43 100644
--- a/net/sched/cls_tcindex.c
+++ b/net/sched/cls_tcindex.c
@@ -448,7 +448,7 @@ static int tcindex_dump(struct tcf_proto *tp, unsigned long fh,
448{ 448{
449 struct tcindex_data *p = PRIV(tp); 449 struct tcindex_data *p = PRIV(tp);
450 struct tcindex_filter_result *r = (struct tcindex_filter_result *) fh; 450 struct tcindex_filter_result *r = (struct tcindex_filter_result *) fh;
451 unsigned char *b = skb->tail; 451 unsigned char *b = skb_tail_pointer(skb);
452 struct rtattr *rta; 452 struct rtattr *rta;
453 453
454 DPRINTK("tcindex_dump(tp %p,fh 0x%lx,skb %p,t %p),p %p,r %p,b %p\n", 454 DPRINTK("tcindex_dump(tp %p,fh 0x%lx,skb %p,t %p),p %p,r %p,b %p\n",
@@ -463,7 +463,7 @@ static int tcindex_dump(struct tcf_proto *tp, unsigned long fh,
463 RTA_PUT(skb,TCA_TCINDEX_SHIFT,sizeof(p->shift),&p->shift); 463 RTA_PUT(skb,TCA_TCINDEX_SHIFT,sizeof(p->shift),&p->shift);
464 RTA_PUT(skb,TCA_TCINDEX_FALL_THROUGH,sizeof(p->fall_through), 464 RTA_PUT(skb,TCA_TCINDEX_FALL_THROUGH,sizeof(p->fall_through),
465 &p->fall_through); 465 &p->fall_through);
466 rta->rta_len = skb->tail-b; 466 rta->rta_len = skb_tail_pointer(skb) - b;
467 } else { 467 } else {
468 if (p->perfect) { 468 if (p->perfect) {
469 t->tcm_handle = r-p->perfect; 469 t->tcm_handle = r-p->perfect;
@@ -486,7 +486,7 @@ static int tcindex_dump(struct tcf_proto *tp, unsigned long fh,
486 486
487 if (tcf_exts_dump(skb, &r->exts, &tcindex_ext_map) < 0) 487 if (tcf_exts_dump(skb, &r->exts, &tcindex_ext_map) < 0)
488 goto rtattr_failure; 488 goto rtattr_failure;
489 rta->rta_len = skb->tail-b; 489 rta->rta_len = skb_tail_pointer(skb) - b;
490 490
491 if (tcf_exts_dump_stats(skb, &r->exts, &tcindex_ext_map) < 0) 491 if (tcf_exts_dump_stats(skb, &r->exts, &tcindex_ext_map) < 0)
492 goto rtattr_failure; 492 goto rtattr_failure;
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c
index 695b34051b9f..fa11bb750049 100644
--- a/net/sched/cls_u32.c
+++ b/net/sched/cls_u32.c
@@ -213,7 +213,7 @@ check_terminal:
213 off2 = 0; 213 off2 = 0;
214 } 214 }
215 215
216 if (ptr < skb->tail) 216 if (ptr < skb_tail_pointer(skb))
217 goto next_ht; 217 goto next_ht;
218 } 218 }
219 219
@@ -718,7 +718,7 @@ static int u32_dump(struct tcf_proto *tp, unsigned long fh,
718 struct sk_buff *skb, struct tcmsg *t) 718 struct sk_buff *skb, struct tcmsg *t)
719{ 719{
720 struct tc_u_knode *n = (struct tc_u_knode*)fh; 720 struct tc_u_knode *n = (struct tc_u_knode*)fh;
721 unsigned char *b = skb->tail; 721 unsigned char *b = skb_tail_pointer(skb);
722 struct rtattr *rta; 722 struct rtattr *rta;
723 723
724 if (n == NULL) 724 if (n == NULL)
@@ -765,7 +765,7 @@ static int u32_dump(struct tcf_proto *tp, unsigned long fh,
765#endif 765#endif
766 } 766 }
767 767
768 rta->rta_len = skb->tail - b; 768 rta->rta_len = skb_tail_pointer(skb) - b;
769 if (TC_U32_KEY(n->handle)) 769 if (TC_U32_KEY(n->handle))
770 if (tcf_exts_dump_stats(skb, &n->exts, &u32_ext_map) < 0) 770 if (tcf_exts_dump_stats(skb, &n->exts, &u32_ext_map) < 0)
771 goto rtattr_failure; 771 goto rtattr_failure;
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)
418int tcf_em_tree_dump(struct sk_buff *skb, struct tcf_ematch_tree *tree, int tlv) 418int 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
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index ecbdc6b42a9c..7482a950717b 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -813,7 +813,7 @@ static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc *q, u32 clid,
813{ 813{
814 struct tcmsg *tcm; 814 struct tcmsg *tcm;
815 struct nlmsghdr *nlh; 815 struct nlmsghdr *nlh;
816 unsigned char *b = skb->tail; 816 unsigned char *b = skb_tail_pointer(skb);
817 struct gnet_dump d; 817 struct gnet_dump d;
818 818
819 nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*tcm), flags); 819 nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*tcm), flags);
@@ -847,7 +847,7 @@ static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc *q, u32 clid,
847 if (gnet_stats_finish_copy(&d) < 0) 847 if (gnet_stats_finish_copy(&d) < 0)
848 goto rtattr_failure; 848 goto rtattr_failure;
849 849
850 nlh->nlmsg_len = skb->tail - b; 850 nlh->nlmsg_len = skb_tail_pointer(skb) - b;
851 return skb->len; 851 return skb->len;
852 852
853nlmsg_failure: 853nlmsg_failure:
@@ -1051,7 +1051,7 @@ static int tc_fill_tclass(struct sk_buff *skb, struct Qdisc *q,
1051{ 1051{
1052 struct tcmsg *tcm; 1052 struct tcmsg *tcm;
1053 struct nlmsghdr *nlh; 1053 struct nlmsghdr *nlh;
1054 unsigned char *b = skb->tail; 1054 unsigned char *b = skb_tail_pointer(skb);
1055 struct gnet_dump d; 1055 struct gnet_dump d;
1056 struct Qdisc_class_ops *cl_ops = q->ops->cl_ops; 1056 struct Qdisc_class_ops *cl_ops = q->ops->cl_ops;
1057 1057
@@ -1076,7 +1076,7 @@ static int tc_fill_tclass(struct sk_buff *skb, struct Qdisc *q,
1076 if (gnet_stats_finish_copy(&d) < 0) 1076 if (gnet_stats_finish_copy(&d) < 0)
1077 goto rtattr_failure; 1077 goto rtattr_failure;
1078 1078
1079 nlh->nlmsg_len = skb->tail - b; 1079 nlh->nlmsg_len = skb_tail_pointer(skb) - b;
1080 return skb->len; 1080 return skb->len;
1081 1081
1082nlmsg_failure: 1082nlmsg_failure:
diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c
index baca8743c12b..1d7bb1632138 100644
--- a/net/sched/sch_atm.c
+++ b/net/sched/sch_atm.c
@@ -631,7 +631,7 @@ static int atm_tc_dump_class(struct Qdisc *sch, unsigned long cl,
631{ 631{
632 struct atm_qdisc_data *p = PRIV(sch); 632 struct atm_qdisc_data *p = PRIV(sch);
633 struct atm_flow_data *flow = (struct atm_flow_data *) cl; 633 struct atm_flow_data *flow = (struct atm_flow_data *) cl;
634 unsigned char *b = skb->tail; 634 unsigned char *b = skb_tail_pointer(skb);
635 struct rtattr *rta; 635 struct rtattr *rta;
636 636
637 DPRINTK("atm_tc_dump_class(sch %p,[qdisc %p],flow %p,skb %p,tcm %p)\n", 637 DPRINTK("atm_tc_dump_class(sch %p,[qdisc %p],flow %p,skb %p,tcm %p)\n",
@@ -661,7 +661,7 @@ static int atm_tc_dump_class(struct Qdisc *sch, unsigned long cl,
661 661
662 RTA_PUT(skb,TCA_ATM_EXCESS,sizeof(zero),&zero); 662 RTA_PUT(skb,TCA_ATM_EXCESS,sizeof(zero),&zero);
663 } 663 }
664 rta->rta_len = skb->tail-b; 664 rta->rta_len = skb_tail_pointer(skb) - b;
665 return skb->len; 665 return skb->len;
666 666
667rtattr_failure: 667rtattr_failure:
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
index d83414d828d8..be98a01253e9 100644
--- a/net/sched/sch_cbq.c
+++ b/net/sched/sch_cbq.c
@@ -1465,7 +1465,7 @@ static int cbq_init(struct Qdisc *sch, struct rtattr *opt)
1465 1465
1466static __inline__ int cbq_dump_rate(struct sk_buff *skb, struct cbq_class *cl) 1466static __inline__ int cbq_dump_rate(struct sk_buff *skb, struct cbq_class *cl)
1467{ 1467{
1468 unsigned char *b = skb->tail; 1468 unsigned char *b = skb_tail_pointer(skb);
1469 1469
1470 RTA_PUT(skb, TCA_CBQ_RATE, sizeof(cl->R_tab->rate), &cl->R_tab->rate); 1470 RTA_PUT(skb, TCA_CBQ_RATE, sizeof(cl->R_tab->rate), &cl->R_tab->rate);
1471 return skb->len; 1471 return skb->len;
@@ -1477,7 +1477,7 @@ rtattr_failure:
1477 1477
1478static __inline__ int cbq_dump_lss(struct sk_buff *skb, struct cbq_class *cl) 1478static __inline__ int cbq_dump_lss(struct sk_buff *skb, struct cbq_class *cl)
1479{ 1479{
1480 unsigned char *b = skb->tail; 1480 unsigned char *b = skb_tail_pointer(skb);
1481 struct tc_cbq_lssopt opt; 1481 struct tc_cbq_lssopt opt;
1482 1482
1483 opt.flags = 0; 1483 opt.flags = 0;
@@ -1502,7 +1502,7 @@ rtattr_failure:
1502 1502
1503static __inline__ int cbq_dump_wrr(struct sk_buff *skb, struct cbq_class *cl) 1503static __inline__ int cbq_dump_wrr(struct sk_buff *skb, struct cbq_class *cl)
1504{ 1504{
1505 unsigned char *b = skb->tail; 1505 unsigned char *b = skb_tail_pointer(skb);
1506 struct tc_cbq_wrropt opt; 1506 struct tc_cbq_wrropt opt;
1507 1507
1508 opt.flags = 0; 1508 opt.flags = 0;
@@ -1520,7 +1520,7 @@ rtattr_failure:
1520 1520
1521static __inline__ int cbq_dump_ovl(struct sk_buff *skb, struct cbq_class *cl) 1521static __inline__ int cbq_dump_ovl(struct sk_buff *skb, struct cbq_class *cl)
1522{ 1522{
1523 unsigned char *b = skb->tail; 1523 unsigned char *b = skb_tail_pointer(skb);
1524 struct tc_cbq_ovl opt; 1524 struct tc_cbq_ovl opt;
1525 1525
1526 opt.strategy = cl->ovl_strategy; 1526 opt.strategy = cl->ovl_strategy;
@@ -1537,7 +1537,7 @@ rtattr_failure:
1537 1537
1538static __inline__ int cbq_dump_fopt(struct sk_buff *skb, struct cbq_class *cl) 1538static __inline__ int cbq_dump_fopt(struct sk_buff *skb, struct cbq_class *cl)
1539{ 1539{
1540 unsigned char *b = skb->tail; 1540 unsigned char *b = skb_tail_pointer(skb);
1541 struct tc_cbq_fopt opt; 1541 struct tc_cbq_fopt opt;
1542 1542
1543 if (cl->split || cl->defmap) { 1543 if (cl->split || cl->defmap) {
@@ -1556,7 +1556,7 @@ rtattr_failure:
1556#ifdef CONFIG_NET_CLS_POLICE 1556#ifdef CONFIG_NET_CLS_POLICE
1557static __inline__ int cbq_dump_police(struct sk_buff *skb, struct cbq_class *cl) 1557static __inline__ int cbq_dump_police(struct sk_buff *skb, struct cbq_class *cl)
1558{ 1558{
1559 unsigned char *b = skb->tail; 1559 unsigned char *b = skb_tail_pointer(skb);
1560 struct tc_cbq_police opt; 1560 struct tc_cbq_police opt;
1561 1561
1562 if (cl->police) { 1562 if (cl->police) {
@@ -1590,14 +1590,14 @@ static int cbq_dump_attr(struct sk_buff *skb, struct cbq_class *cl)
1590static int cbq_dump(struct Qdisc *sch, struct sk_buff *skb) 1590static int cbq_dump(struct Qdisc *sch, struct sk_buff *skb)
1591{ 1591{
1592 struct cbq_sched_data *q = qdisc_priv(sch); 1592 struct cbq_sched_data *q = qdisc_priv(sch);
1593 unsigned char *b = skb->tail; 1593 unsigned char *b = skb_tail_pointer(skb);
1594 struct rtattr *rta; 1594 struct rtattr *rta;
1595 1595
1596 rta = (struct rtattr*)b; 1596 rta = (struct rtattr*)b;
1597 RTA_PUT(skb, TCA_OPTIONS, 0, NULL); 1597 RTA_PUT(skb, TCA_OPTIONS, 0, NULL);
1598 if (cbq_dump_attr(skb, &q->link) < 0) 1598 if (cbq_dump_attr(skb, &q->link) < 0)
1599 goto rtattr_failure; 1599 goto rtattr_failure;
1600 rta->rta_len = skb->tail - b; 1600 rta->rta_len = skb_tail_pointer(skb) - b;
1601 return skb->len; 1601 return skb->len;
1602 1602
1603rtattr_failure: 1603rtattr_failure:
@@ -1619,7 +1619,7 @@ cbq_dump_class(struct Qdisc *sch, unsigned long arg,
1619 struct sk_buff *skb, struct tcmsg *tcm) 1619 struct sk_buff *skb, struct tcmsg *tcm)
1620{ 1620{
1621 struct cbq_class *cl = (struct cbq_class*)arg; 1621 struct cbq_class *cl = (struct cbq_class*)arg;
1622 unsigned char *b = skb->tail; 1622 unsigned char *b = skb_tail_pointer(skb);
1623 struct rtattr *rta; 1623 struct rtattr *rta;
1624 1624
1625 if (cl->tparent) 1625 if (cl->tparent)
@@ -1633,7 +1633,7 @@ cbq_dump_class(struct Qdisc *sch, unsigned long arg,
1633 RTA_PUT(skb, TCA_OPTIONS, 0, NULL); 1633 RTA_PUT(skb, TCA_OPTIONS, 0, NULL);
1634 if (cbq_dump_attr(skb, cl) < 0) 1634 if (cbq_dump_attr(skb, cl) < 0)
1635 goto rtattr_failure; 1635 goto rtattr_failure;
1636 rta->rta_len = skb->tail - b; 1636 rta->rta_len = skb_tail_pointer(skb) - b;
1637 return skb->len; 1637 return skb->len;
1638 1638
1639rtattr_failure: 1639rtattr_failure:
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c
index 5197b6caaf2d..80e6f811e3bc 100644
--- a/net/sched/sch_hfsc.c
+++ b/net/sched/sch_hfsc.c
@@ -1363,7 +1363,7 @@ hfsc_dump_class(struct Qdisc *sch, unsigned long arg, struct sk_buff *skb,
1363 struct tcmsg *tcm) 1363 struct tcmsg *tcm)
1364{ 1364{
1365 struct hfsc_class *cl = (struct hfsc_class *)arg; 1365 struct hfsc_class *cl = (struct hfsc_class *)arg;
1366 unsigned char *b = skb->tail; 1366 unsigned char *b = skb_tail_pointer(skb);
1367 struct rtattr *rta = (struct rtattr *)b; 1367 struct rtattr *rta = (struct rtattr *)b;
1368 1368
1369 tcm->tcm_parent = cl->cl_parent ? cl->cl_parent->classid : TC_H_ROOT; 1369 tcm->tcm_parent = cl->cl_parent ? cl->cl_parent->classid : TC_H_ROOT;
@@ -1374,7 +1374,7 @@ hfsc_dump_class(struct Qdisc *sch, unsigned long arg, struct sk_buff *skb,
1374 RTA_PUT(skb, TCA_OPTIONS, 0, NULL); 1374 RTA_PUT(skb, TCA_OPTIONS, 0, NULL);
1375 if (hfsc_dump_curves(skb, cl) < 0) 1375 if (hfsc_dump_curves(skb, cl) < 0)
1376 goto rtattr_failure; 1376 goto rtattr_failure;
1377 rta->rta_len = skb->tail - b; 1377 rta->rta_len = skb_tail_pointer(skb) - b;
1378 return skb->len; 1378 return skb->len;
1379 1379
1380 rtattr_failure: 1380 rtattr_failure:
@@ -1576,7 +1576,7 @@ static int
1576hfsc_dump_qdisc(struct Qdisc *sch, struct sk_buff *skb) 1576hfsc_dump_qdisc(struct Qdisc *sch, struct sk_buff *skb)
1577{ 1577{
1578 struct hfsc_sched *q = qdisc_priv(sch); 1578 struct hfsc_sched *q = qdisc_priv(sch);
1579 unsigned char *b = skb->tail; 1579 unsigned char *b = skb_tail_pointer(skb);
1580 struct tc_hfsc_qopt qopt; 1580 struct tc_hfsc_qopt qopt;
1581 1581
1582 qopt.defcls = q->defcls; 1582 qopt.defcls = q->defcls;
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index f76c20c0a109..c687388a8cb6 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -1110,7 +1110,7 @@ static int htb_init(struct Qdisc *sch, struct rtattr *opt)
1110static int htb_dump(struct Qdisc *sch, struct sk_buff *skb) 1110static int htb_dump(struct Qdisc *sch, struct sk_buff *skb)
1111{ 1111{
1112 struct htb_sched *q = qdisc_priv(sch); 1112 struct htb_sched *q = qdisc_priv(sch);
1113 unsigned char *b = skb->tail; 1113 unsigned char *b = skb_tail_pointer(skb);
1114 struct rtattr *rta; 1114 struct rtattr *rta;
1115 struct tc_htb_glob gopt; 1115 struct tc_htb_glob gopt;
1116 spin_lock_bh(&sch->dev->queue_lock); 1116 spin_lock_bh(&sch->dev->queue_lock);
@@ -1123,12 +1123,12 @@ static int htb_dump(struct Qdisc *sch, struct sk_buff *skb)
1123 rta = (struct rtattr *)b; 1123 rta = (struct rtattr *)b;
1124 RTA_PUT(skb, TCA_OPTIONS, 0, NULL); 1124 RTA_PUT(skb, TCA_OPTIONS, 0, NULL);
1125 RTA_PUT(skb, TCA_HTB_INIT, sizeof(gopt), &gopt); 1125 RTA_PUT(skb, TCA_HTB_INIT, sizeof(gopt), &gopt);
1126 rta->rta_len = skb->tail - b; 1126 rta->rta_len = skb_tail_pointer(skb) - b;
1127 spin_unlock_bh(&sch->dev->queue_lock); 1127 spin_unlock_bh(&sch->dev->queue_lock);
1128 return skb->len; 1128 return skb->len;
1129rtattr_failure: 1129rtattr_failure:
1130 spin_unlock_bh(&sch->dev->queue_lock); 1130 spin_unlock_bh(&sch->dev->queue_lock);
1131 skb_trim(skb, skb->tail - skb->data); 1131 skb_trim(skb, skb_tail_pointer(skb) - skb->data);
1132 return -1; 1132 return -1;
1133} 1133}
1134 1134
@@ -1136,7 +1136,7 @@ static int htb_dump_class(struct Qdisc *sch, unsigned long arg,
1136 struct sk_buff *skb, struct tcmsg *tcm) 1136 struct sk_buff *skb, struct tcmsg *tcm)
1137{ 1137{
1138 struct htb_class *cl = (struct htb_class *)arg; 1138 struct htb_class *cl = (struct htb_class *)arg;
1139 unsigned char *b = skb->tail; 1139 unsigned char *b = skb_tail_pointer(skb);
1140 struct rtattr *rta; 1140 struct rtattr *rta;
1141 struct tc_htb_opt opt; 1141 struct tc_htb_opt opt;
1142 1142
@@ -1159,7 +1159,7 @@ static int htb_dump_class(struct Qdisc *sch, unsigned long arg,
1159 opt.prio = cl->un.leaf.prio; 1159 opt.prio = cl->un.leaf.prio;
1160 opt.level = cl->level; 1160 opt.level = cl->level;
1161 RTA_PUT(skb, TCA_HTB_PARMS, sizeof(opt), &opt); 1161 RTA_PUT(skb, TCA_HTB_PARMS, sizeof(opt), &opt);
1162 rta->rta_len = skb->tail - b; 1162 rta->rta_len = skb_tail_pointer(skb) - b;
1163 spin_unlock_bh(&sch->dev->queue_lock); 1163 spin_unlock_bh(&sch->dev->queue_lock);
1164 return skb->len; 1164 return skb->len;
1165rtattr_failure: 1165rtattr_failure:
diff --git a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c
index cfe070ee6ee3..d19f4070c237 100644
--- a/net/sched/sch_ingress.c
+++ b/net/sched/sch_ingress.c
@@ -362,12 +362,12 @@ static void ingress_destroy(struct Qdisc *sch)
362 362
363static int ingress_dump(struct Qdisc *sch, struct sk_buff *skb) 363static int ingress_dump(struct Qdisc *sch, struct sk_buff *skb)
364{ 364{
365 unsigned char *b = skb->tail; 365 unsigned char *b = skb_tail_pointer(skb);
366 struct rtattr *rta; 366 struct rtattr *rta;
367 367
368 rta = (struct rtattr *) b; 368 rta = (struct rtattr *) b;
369 RTA_PUT(skb, TCA_OPTIONS, 0, NULL); 369 RTA_PUT(skb, TCA_OPTIONS, 0, NULL);
370 rta->rta_len = skb->tail - b; 370 rta->rta_len = skb_tail_pointer(skb) - b;
371 return skb->len; 371 return skb->len;
372 372
373rtattr_failure: 373rtattr_failure:
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
index 915f82a2cc3d..2a9b1e429ff8 100644
--- a/net/sched/sch_netem.c
+++ b/net/sched/sch_netem.c
@@ -583,7 +583,7 @@ static void netem_destroy(struct Qdisc *sch)
583static int netem_dump(struct Qdisc *sch, struct sk_buff *skb) 583static int netem_dump(struct Qdisc *sch, struct sk_buff *skb)
584{ 584{
585 const struct netem_sched_data *q = qdisc_priv(sch); 585 const struct netem_sched_data *q = qdisc_priv(sch);
586 unsigned char *b = skb->tail; 586 unsigned char *b = skb_tail_pointer(skb);
587 struct rtattr *rta = (struct rtattr *) b; 587 struct rtattr *rta = (struct rtattr *) b;
588 struct tc_netem_qopt qopt; 588 struct tc_netem_qopt qopt;
589 struct tc_netem_corr cor; 589 struct tc_netem_corr cor;
@@ -611,7 +611,7 @@ static int netem_dump(struct Qdisc *sch, struct sk_buff *skb)
611 corrupt.correlation = q->corrupt_cor.rho; 611 corrupt.correlation = q->corrupt_cor.rho;
612 RTA_PUT(skb, TCA_NETEM_CORRUPT, sizeof(corrupt), &corrupt); 612 RTA_PUT(skb, TCA_NETEM_CORRUPT, sizeof(corrupt), &corrupt);
613 613
614 rta->rta_len = skb->tail - b; 614 rta->rta_len = skb_tail_pointer(skb) - b;
615 615
616 return skb->len; 616 return skb->len;
617 617
diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c
index de889f23f22a..5b371109ec1c 100644
--- a/net/sched/sch_prio.c
+++ b/net/sched/sch_prio.c
@@ -271,7 +271,7 @@ static int prio_init(struct Qdisc *sch, struct rtattr *opt)
271static int prio_dump(struct Qdisc *sch, struct sk_buff *skb) 271static int prio_dump(struct Qdisc *sch, struct sk_buff *skb)
272{ 272{
273 struct prio_sched_data *q = qdisc_priv(sch); 273 struct prio_sched_data *q = qdisc_priv(sch);
274 unsigned char *b = skb->tail; 274 unsigned char *b = skb_tail_pointer(skb);
275 struct tc_prio_qopt opt; 275 struct tc_prio_qopt opt;
276 276
277 opt.bands = q->bands; 277 opt.bands = q->bands;
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c
index e3695407afc6..a511ba83e26f 100644
--- a/net/sched/sch_sfq.c
+++ b/net/sched/sch_sfq.c
@@ -461,7 +461,7 @@ static void sfq_destroy(struct Qdisc *sch)
461static int sfq_dump(struct Qdisc *sch, struct sk_buff *skb) 461static int sfq_dump(struct Qdisc *sch, struct sk_buff *skb)
462{ 462{
463 struct sfq_sched_data *q = qdisc_priv(sch); 463 struct sfq_sched_data *q = qdisc_priv(sch);
464 unsigned char *b = skb->tail; 464 unsigned char *b = skb_tail_pointer(skb);
465 struct tc_sfq_qopt opt; 465 struct tc_sfq_qopt opt;
466 466
467 opt.quantum = q->quantum; 467 opt.quantum = q->quantum;
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
index f14692f3a14e..231895562c66 100644
--- a/net/sched/sch_tbf.c
+++ b/net/sched/sch_tbf.c
@@ -387,7 +387,7 @@ static void tbf_destroy(struct Qdisc *sch)
387static int tbf_dump(struct Qdisc *sch, struct sk_buff *skb) 387static int tbf_dump(struct Qdisc *sch, struct sk_buff *skb)
388{ 388{
389 struct tbf_sched_data *q = qdisc_priv(sch); 389 struct tbf_sched_data *q = qdisc_priv(sch);
390 unsigned char *b = skb->tail; 390 unsigned char *b = skb_tail_pointer(skb);
391 struct rtattr *rta; 391 struct rtattr *rta;
392 struct tc_tbf_qopt opt; 392 struct tc_tbf_qopt opt;
393 393
@@ -403,7 +403,7 @@ static int tbf_dump(struct Qdisc *sch, struct sk_buff *skb)
403 opt.mtu = q->mtu; 403 opt.mtu = q->mtu;
404 opt.buffer = q->buffer; 404 opt.buffer = q->buffer;
405 RTA_PUT(skb, TCA_TBF_PARMS, sizeof(opt), &opt); 405 RTA_PUT(skb, TCA_TBF_PARMS, sizeof(opt), &opt);
406 rta->rta_len = skb->tail - b; 406 rta->rta_len = skb_tail_pointer(skb) - b;
407 407
408 return skb->len; 408 return skb->len;
409 409