aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/act_police.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2008-01-23 23:34:11 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:11:18 -0500
commit4b3550ef530cfc153fa91f0b37cbda448bad11c6 (patch)
tree02aba7497298f220629af8e47f48e56df86d428f /net/sched/act_police.c
parentcee63723b358e594225e812d6e14a2a0abfd5c88 (diff)
[NET_SCHED]: Use nla_nest_start/nla_nest_end
Use nla_nest_start/nla_nest_end for dumping nested attributes. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/act_police.c')
-rw-r--r--net/sched/act_police.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/net/sched/act_police.c b/net/sched/act_police.c
index c0fce9b98412..ee2f1b64dd70 100644
--- a/net/sched/act_police.c
+++ b/net/sched/act_police.c
@@ -54,7 +54,7 @@ static int tcf_act_police_walker(struct sk_buff *skb, struct netlink_callback *c
54{ 54{
55 struct tcf_common *p; 55 struct tcf_common *p;
56 int err = 0, index = -1, i = 0, s_i = 0, n_i = 0; 56 int err = 0, index = -1, i = 0, s_i = 0, n_i = 0;
57 struct nlattr *r; 57 struct nlattr *nest;
58 58
59 read_lock_bh(&police_lock); 59 read_lock_bh(&police_lock);
60 60
@@ -69,18 +69,19 @@ static int tcf_act_police_walker(struct sk_buff *skb, struct netlink_callback *c
69 continue; 69 continue;
70 a->priv = p; 70 a->priv = p;
71 a->order = index; 71 a->order = index;
72 r = (struct nlattr *)skb_tail_pointer(skb); 72 nest = nla_nest_start(skb, a->order);
73 NLA_PUT(skb, a->order, 0, NULL); 73 if (nest == NULL)
74 goto nla_put_failure;
74 if (type == RTM_DELACTION) 75 if (type == RTM_DELACTION)
75 err = tcf_action_dump_1(skb, a, 0, 1); 76 err = tcf_action_dump_1(skb, a, 0, 1);
76 else 77 else
77 err = tcf_action_dump_1(skb, a, 0, 0); 78 err = tcf_action_dump_1(skb, a, 0, 0);
78 if (err < 0) { 79 if (err < 0) {
79 index--; 80 index--;
80 nlmsg_trim(skb, r); 81 nla_nest_cancel(skb, nest);
81 goto done; 82 goto done;
82 } 83 }
83 r->nla_len = skb_tail_pointer(skb) - (u8 *)r; 84 nla_nest_end(skb, nest);
84 n_i++; 85 n_i++;
85 } 86 }
86 } 87 }
@@ -91,7 +92,7 @@ done:
91 return n_i; 92 return n_i;
92 93
93nla_put_failure: 94nla_put_failure:
94 nlmsg_trim(skb, r); 95 nla_nest_cancel(skb, nest);
95 goto done; 96 goto done;
96} 97}
97 98