Skip to content

Commit 6ea3b44

Browse files
jpirkodavem330
authored andcommitted
net: sched: cls: use nla_nest_cancel instead of nlmsg_trim
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>
1 parent f9c5c62 commit 6ea3b44

File tree

6 files changed

+8
-13
lines changed

6 files changed

+8
-13
lines changed

net/sched/cls_cgroup.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ static int cls_cgroup_dump(struct net *net, struct tcf_proto *tp, unsigned long
177177
struct sk_buff *skb, struct tcmsg *t)
178178
{
179179
struct cls_cgroup_head *head = rtnl_dereference(tp->root);
180-
unsigned char *b = skb_tail_pointer(skb);
181180
struct nlattr *nest;
182181

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

200199
nla_put_failure:
201-
nlmsg_trim(skb, b);
200+
nla_nest_cancel(skb, nest);
202201
return -1;
203202
}
204203

net/sched/cls_flow.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ static int flow_dump(struct net *net, struct tcf_proto *tp, unsigned long fh,
638638
return skb->len;
639639

640640
nla_put_failure:
641-
nlmsg_trim(skb, nest);
641+
nla_nest_cancel(skb, nest);
642642
return -1;
643643
}
644644

net/sched/cls_fw.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,6 @@ static int fw_dump(struct net *net, struct tcf_proto *tp, unsigned long fh,
356356
{
357357
struct fw_head *head = rtnl_dereference(tp->root);
358358
struct fw_filter *f = (struct fw_filter *)fh;
359-
unsigned char *b = skb_tail_pointer(skb);
360359
struct nlattr *nest;
361360

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

399398
nla_put_failure:
400-
nlmsg_trim(skb, b);
399+
nla_nest_cancel(skb, nest);
401400
return -1;
402401
}
403402

net/sched/cls_route.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,6 @@ static int route4_dump(struct net *net, struct tcf_proto *tp, unsigned long fh,
593593
struct sk_buff *skb, struct tcmsg *t)
594594
{
595595
struct route4_filter *f = (struct route4_filter *)fh;
596-
unsigned char *b = skb_tail_pointer(skb);
597596
struct nlattr *nest;
598597
u32 id;
599598

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

637636
nla_put_failure:
638-
nlmsg_trim(skb, b);
637+
nla_nest_cancel(skb, nest);
639638
return -1;
640639
}
641640

net/sched/cls_rsvp.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,6 @@ static int rsvp_dump(struct net *net, struct tcf_proto *tp, unsigned long fh,
653653
{
654654
struct rsvp_filter *f = (struct rsvp_filter *)fh;
655655
struct rsvp_session *s;
656-
unsigned char *b = skb_tail_pointer(skb);
657656
struct nlattr *nest;
658657
struct tc_rsvp_pinfo pinfo;
659658

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

696695
nla_put_failure:
697-
nlmsg_trim(skb, b);
696+
nla_nest_cancel(skb, nest);
698697
return -1;
699698
}
700699

net/sched/cls_tcindex.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -489,11 +489,10 @@ static int tcindex_dump(struct net *net, struct tcf_proto *tp, unsigned long fh,
489489
{
490490
struct tcindex_data *p = rtnl_dereference(tp->root);
491491
struct tcindex_filter_result *r = (struct tcindex_filter_result *) fh;
492-
unsigned char *b = skb_tail_pointer(skb);
493492
struct nlattr *nest;
494493

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

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

545544
nla_put_failure:
546-
nlmsg_trim(skb, b);
545+
nla_nest_cancel(skb, nest);
547546
return -1;
548547
}
549548

0 commit comments

Comments
 (0)