summaryrefslogtreecommitdiffstats
path: root/net/sched/ematch.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2008-01-24 05:34:11 +0100
committerDavid S. Miller <davem@davemloft.net>2008-01-29 00:11:18 +0100
commit4b3550ef530cfc153fa91f0b37cbda448bad11c6 (patch)
tree02aba7497298f220629af8e47f48e56df86d428f /net/sched/ematch.c
parent[NET_SCHED]: Propagate nla_parse return value (diff)
downloadlinux-4b3550ef530cfc153fa91f0b37cbda448bad11c6.tar.xz
linux-4b3550ef530cfc153fa91f0b37cbda448bad11c6.zip
[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/ematch.c')
-rw-r--r--net/sched/ematch.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/net/sched/ematch.c b/net/sched/ematch.c
index d2b480f01a40..daa9c4e7e81d 100644
--- a/net/sched/ematch.c
+++ b/net/sched/ematch.c
@@ -436,14 +436,18 @@ int tcf_em_tree_dump(struct sk_buff *skb, struct tcf_ematch_tree *tree, int tlv)
{
int i;
u8 *tail;
- struct nlattr *top_start = (struct nlattr *)skb_tail_pointer(skb);
+ struct nlattr *top_start;
struct nlattr *list_start;
- NLA_PUT(skb, tlv, 0, NULL);
+ top_start = nla_nest_start(skb, tlv);
+ if (top_start == NULL)
+ goto nla_put_failure;
+
NLA_PUT(skb, TCA_EMATCH_TREE_HDR, sizeof(tree->hdr), &tree->hdr);
- list_start = (struct nlattr *)skb_tail_pointer(skb);
- NLA_PUT(skb, TCA_EMATCH_TREE_LIST, 0, NULL);
+ list_start = nla_nest_start(skb, TCA_EMATCH_TREE_LIST);
+ if (list_start == NULL)
+ goto nla_put_failure;
tail = skb_tail_pointer(skb);
for (i = 0; i < tree->hdr.nmatches; i++) {
@@ -470,8 +474,8 @@ int tcf_em_tree_dump(struct sk_buff *skb, struct tcf_ematch_tree *tree, int tlv)
match_start->nla_len = tail - (u8 *)match_start;
}
- list_start->nla_len = tail - (u8 *)list_start;
- top_start->nla_len = tail - (u8 *)top_start;
+ nla_nest_end(skb, list_start);
+ nla_nest_end(skb, top_start);
return 0;