diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2007-03-26 02:06:12 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:26:37 -0400 |
commit | dc5fc579b90ed0a9a4e55b0218cdbaf0a8cf2e67 (patch) | |
tree | 673dbb425c2b09b4256ef71f89dfc5cc01944386 /net/sched/act_api.c | |
parent | a36ca733375860b389c15ffdf6a5f92df64a33b6 (diff) |
[NETLINK]: Use nlmsg_trim() where appropriate
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/act_api.c')
-rw-r--r-- | net/sched/act_api.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 28326fb1fc4e..f002f74f3763 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <net/sock.h> | 31 | #include <net/sock.h> |
32 | #include <net/sch_generic.h> | 32 | #include <net/sch_generic.h> |
33 | #include <net/act_api.h> | 33 | #include <net/act_api.h> |
34 | #include <net/netlink.h> | ||
34 | 35 | ||
35 | void tcf_hash_destroy(struct tcf_common *p, struct tcf_hashinfo *hinfo) | 36 | void tcf_hash_destroy(struct tcf_common *p, struct tcf_hashinfo *hinfo) |
36 | { | 37 | { |
@@ -98,7 +99,7 @@ static int tcf_dump_walker(struct sk_buff *skb, struct netlink_callback *cb, | |||
98 | err = tcf_action_dump_1(skb, a, 0, 0); | 99 | err = tcf_action_dump_1(skb, a, 0, 0); |
99 | if (err < 0) { | 100 | if (err < 0) { |
100 | index--; | 101 | index--; |
101 | skb_trim(skb, (u8*)r - skb->data); | 102 | nlmsg_trim(skb, r); |
102 | goto done; | 103 | goto done; |
103 | } | 104 | } |
104 | r->rta_len = skb_tail_pointer(skb) - (u8 *)r; | 105 | r->rta_len = skb_tail_pointer(skb) - (u8 *)r; |
@@ -114,7 +115,7 @@ done: | |||
114 | return n_i; | 115 | return n_i; |
115 | 116 | ||
116 | rtattr_failure: | 117 | rtattr_failure: |
117 | skb_trim(skb, (u8*)r - skb->data); | 118 | nlmsg_trim(skb, r); |
118 | goto done; | 119 | goto done; |
119 | } | 120 | } |
120 | 121 | ||
@@ -144,7 +145,7 @@ static int tcf_del_walker(struct sk_buff *skb, struct tc_action *a, | |||
144 | 145 | ||
145 | return n_i; | 146 | return n_i; |
146 | rtattr_failure: | 147 | rtattr_failure: |
147 | skb_trim(skb, (u8*)r - skb->data); | 148 | nlmsg_trim(skb, r); |
148 | return -EINVAL; | 149 | return -EINVAL; |
149 | } | 150 | } |
150 | 151 | ||
@@ -440,7 +441,7 @@ tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int bind, int ref) | |||
440 | } | 441 | } |
441 | 442 | ||
442 | rtattr_failure: | 443 | rtattr_failure: |
443 | skb_trim(skb, b - skb->data); | 444 | nlmsg_trim(skb, b); |
444 | return -1; | 445 | return -1; |
445 | } | 446 | } |
446 | 447 | ||
@@ -467,7 +468,7 @@ tcf_action_dump(struct sk_buff *skb, struct tc_action *act, int bind, int ref) | |||
467 | rtattr_failure: | 468 | rtattr_failure: |
468 | err = -EINVAL; | 469 | err = -EINVAL; |
469 | errout: | 470 | errout: |
470 | skb_trim(skb, b - skb->data); | 471 | nlmsg_trim(skb, b); |
471 | return err; | 472 | return err; |
472 | } | 473 | } |
473 | 474 | ||
@@ -658,7 +659,7 @@ tca_get_fill(struct sk_buff *skb, struct tc_action *a, u32 pid, u32 seq, | |||
658 | 659 | ||
659 | rtattr_failure: | 660 | rtattr_failure: |
660 | nlmsg_failure: | 661 | nlmsg_failure: |
661 | skb_trim(skb, b - skb->data); | 662 | nlmsg_trim(skb, b); |
662 | return -1; | 663 | return -1; |
663 | } | 664 | } |
664 | 665 | ||
@@ -1059,7 +1060,7 @@ tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb) | |||
1059 | x->rta_len = skb_tail_pointer(skb) - (u8 *)x; | 1060 | x->rta_len = skb_tail_pointer(skb) - (u8 *)x; |
1060 | ret = skb->len; | 1061 | ret = skb->len; |
1061 | } else | 1062 | } else |
1062 | skb_trim(skb, (u8*)x - skb->data); | 1063 | nlmsg_trim(skb, x); |
1063 | 1064 | ||
1064 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; | 1065 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; |
1065 | if (NETLINK_CB(cb->skb).pid && ret) | 1066 | if (NETLINK_CB(cb->skb).pid && ret) |
@@ -1070,7 +1071,7 @@ tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb) | |||
1070 | rtattr_failure: | 1071 | rtattr_failure: |
1071 | nlmsg_failure: | 1072 | nlmsg_failure: |
1072 | module_put(a_o->owner); | 1073 | module_put(a_o->owner); |
1073 | skb_trim(skb, b - skb->data); | 1074 | nlmsg_trim(skb, b); |
1074 | return skb->len; | 1075 | return skb->len; |
1075 | } | 1076 | } |
1076 | 1077 | ||