diff options
author | David S. Miller <davem@davemloft.net> | 2012-06-27 00:48:50 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-06-27 00:54:15 -0400 |
commit | 942b81653a5252fc0d7071f685113fc0ada28d4b (patch) | |
tree | af48a03772e4af940000b3d5ab19e7c93ffe97e9 /net/sched/cls_api.c | |
parent | 3f7a3283ccfa59e0dbbc59a6710bd37ba44d4333 (diff) |
pkt_sched: cls_api: Move away from NLMSG_NEW().
And use nlmsg_data() while we're here too, as well as remove
a useless cast.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/cls_api.c')
-rw-r--r-- | net/sched/cls_api.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index f452f696b4b3..6dd1131f2ec1 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c | |||
@@ -140,7 +140,7 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg) | |||
140 | int tp_created = 0; | 140 | int tp_created = 0; |
141 | 141 | ||
142 | replay: | 142 | replay: |
143 | t = NLMSG_DATA(n); | 143 | t = nlmsg_data(n); |
144 | protocol = TC_H_MIN(t->tcm_info); | 144 | protocol = TC_H_MIN(t->tcm_info); |
145 | prio = TC_H_MAJ(t->tcm_info); | 145 | prio = TC_H_MAJ(t->tcm_info); |
146 | nprio = prio; | 146 | nprio = prio; |
@@ -349,8 +349,10 @@ static int tcf_fill_node(struct sk_buff *skb, struct tcf_proto *tp, | |||
349 | struct nlmsghdr *nlh; | 349 | struct nlmsghdr *nlh; |
350 | unsigned char *b = skb_tail_pointer(skb); | 350 | unsigned char *b = skb_tail_pointer(skb); |
351 | 351 | ||
352 | nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*tcm), flags); | 352 | nlh = nlmsg_put(skb, pid, seq, event, sizeof(*tcm), flags); |
353 | tcm = NLMSG_DATA(nlh); | 353 | if (!nlh) |
354 | goto out_nlmsg_trim; | ||
355 | tcm = nlmsg_data(nlh); | ||
354 | tcm->tcm_family = AF_UNSPEC; | 356 | tcm->tcm_family = AF_UNSPEC; |
355 | tcm->tcm__pad1 = 0; | 357 | tcm->tcm__pad1 = 0; |
356 | tcm->tcm__pad2 = 0; | 358 | tcm->tcm__pad2 = 0; |
@@ -368,7 +370,7 @@ static int tcf_fill_node(struct sk_buff *skb, struct tcf_proto *tp, | |||
368 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; | 370 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; |
369 | return skb->len; | 371 | return skb->len; |
370 | 372 | ||
371 | nlmsg_failure: | 373 | out_nlmsg_trim: |
372 | nla_put_failure: | 374 | nla_put_failure: |
373 | nlmsg_trim(skb, b); | 375 | nlmsg_trim(skb, b); |
374 | return -1; | 376 | return -1; |
@@ -418,7 +420,7 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb) | |||
418 | struct net_device *dev; | 420 | struct net_device *dev; |
419 | struct Qdisc *q; | 421 | struct Qdisc *q; |
420 | struct tcf_proto *tp, **chain; | 422 | struct tcf_proto *tp, **chain; |
421 | struct tcmsg *tcm = (struct tcmsg *)NLMSG_DATA(cb->nlh); | 423 | struct tcmsg *tcm = nlmsg_data(cb->nlh); |
422 | unsigned long cl = 0; | 424 | unsigned long cl = 0; |
423 | const struct Qdisc_class_ops *cops; | 425 | const struct Qdisc_class_ops *cops; |
424 | struct tcf_dump_args arg; | 426 | struct tcf_dump_args arg; |