Skip to content

Commit

Permalink
net: sched: cls: use nla_nest_cancel instead of nlmsg_trim
Browse files Browse the repository at this point in the history
To cancel nesting, this function is more convenient.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
jpirko authored and davem330 committed Dec 10, 2014
1 parent f9c5c62 commit 6ea3b44
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 13 deletions.
3 changes: 1 addition & 2 deletions net/sched/cls_cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ static int cls_cgroup_dump(struct net *net, struct tcf_proto *tp, unsigned long
struct sk_buff *skb, struct tcmsg *t)
{
struct cls_cgroup_head *head = rtnl_dereference(tp->root);
unsigned char *b = skb_tail_pointer(skb);
struct nlattr *nest;

t->tcm_handle = head->handle;
Expand All @@ -198,7 +197,7 @@ static int cls_cgroup_dump(struct net *net, struct tcf_proto *tp, unsigned long
return skb->len;

nla_put_failure:
nlmsg_trim(skb, b);
nla_nest_cancel(skb, nest);
return -1;
}

Expand Down
2 changes: 1 addition & 1 deletion net/sched/cls_flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ static int flow_dump(struct net *net, struct tcf_proto *tp, unsigned long fh,
return skb->len;

nla_put_failure:
nlmsg_trim(skb, nest);
nla_nest_cancel(skb, nest);
return -1;
}

Expand Down
3 changes: 1 addition & 2 deletions net/sched/cls_fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,6 @@ static int fw_dump(struct net *net, struct tcf_proto *tp, unsigned long fh,
{
struct fw_head *head = rtnl_dereference(tp->root);
struct fw_filter *f = (struct fw_filter *)fh;
unsigned char *b = skb_tail_pointer(skb);
struct nlattr *nest;

if (f == NULL)
Expand Down Expand Up @@ -397,7 +396,7 @@ static int fw_dump(struct net *net, struct tcf_proto *tp, unsigned long fh,
return skb->len;

nla_put_failure:
nlmsg_trim(skb, b);
nla_nest_cancel(skb, nest);
return -1;
}

Expand Down
3 changes: 1 addition & 2 deletions net/sched/cls_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,6 @@ static int route4_dump(struct net *net, struct tcf_proto *tp, unsigned long fh,
struct sk_buff *skb, struct tcmsg *t)
{
struct route4_filter *f = (struct route4_filter *)fh;
unsigned char *b = skb_tail_pointer(skb);
struct nlattr *nest;
u32 id;

Expand Down Expand Up @@ -635,7 +634,7 @@ static int route4_dump(struct net *net, struct tcf_proto *tp, unsigned long fh,
return skb->len;

nla_put_failure:
nlmsg_trim(skb, b);
nla_nest_cancel(skb, nest);
return -1;
}

Expand Down
3 changes: 1 addition & 2 deletions net/sched/cls_rsvp.h
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,6 @@ static int rsvp_dump(struct net *net, struct tcf_proto *tp, unsigned long fh,
{
struct rsvp_filter *f = (struct rsvp_filter *)fh;
struct rsvp_session *s;
unsigned char *b = skb_tail_pointer(skb);
struct nlattr *nest;
struct tc_rsvp_pinfo pinfo;

Expand Down Expand Up @@ -694,7 +693,7 @@ static int rsvp_dump(struct net *net, struct tcf_proto *tp, unsigned long fh,
return skb->len;

nla_put_failure:
nlmsg_trim(skb, b);
nla_nest_cancel(skb, nest);
return -1;
}

Expand Down
7 changes: 3 additions & 4 deletions net/sched/cls_tcindex.c
Original file line number Diff line number Diff line change
Expand Up @@ -489,11 +489,10 @@ static int tcindex_dump(struct net *net, struct tcf_proto *tp, unsigned long fh,
{
struct tcindex_data *p = rtnl_dereference(tp->root);
struct tcindex_filter_result *r = (struct tcindex_filter_result *) fh;
unsigned char *b = skb_tail_pointer(skb);
struct nlattr *nest;

pr_debug("tcindex_dump(tp %p,fh 0x%lx,skb %p,t %p),p %p,r %p,b %p\n",
tp, fh, skb, t, p, r, b);
pr_debug("tcindex_dump(tp %p,fh 0x%lx,skb %p,t %p),p %p,r %p\n",
tp, fh, skb, t, p, r);
pr_debug("p->perfect %p p->h %p\n", p->perfect, p->h);

nest = nla_nest_start(skb, TCA_OPTIONS);
Expand Down Expand Up @@ -543,7 +542,7 @@ static int tcindex_dump(struct net *net, struct tcf_proto *tp, unsigned long fh,
return skb->len;

nla_put_failure:
nlmsg_trim(skb, b);
nla_nest_cancel(skb, nest);
return -1;
}

Expand Down

0 comments on commit 6ea3b44

Please sign in to comment.