summaryrefslogtreecommitdiffstats
path: root/net/sched
diff options
context:
space:
mode:
authorstephen hemminger <shemminger@vyatta.com>2011-02-23 13:04:17 +0000
committerDavid S. Miller <davem@davemloft.net>2011-02-24 22:11:53 -0800
commit861d7f745f37506bbd90227e97b95baf2a5fac34 (patch)
tree023daf46baaadcf3f4ca049cb9e548e9410017ab /net/sched
parent290f5e3b594af70ac8f7fab44dba79ccae1531cd (diff)
downloadlinux-861d7f745f37506bbd90227e97b95baf2a5fac34.tar.bz2
netem: cleanup dump code
Use nla_put_nested to update netlink attribute value. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched')
-rw-r--r--net/sched/sch_netem.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
index 64f0d3293b49..d367783f6920 100644
--- a/net/sched/sch_netem.c
+++ b/net/sched/sch_netem.c
@@ -562,8 +562,7 @@ static void netem_destroy(struct Qdisc *sch)
static int netem_dump(struct Qdisc *sch, struct sk_buff *skb)
{
const struct netem_sched_data *q = qdisc_priv(sch);
- unsigned char *b = skb_tail_pointer(skb);
- struct nlattr *nla = (struct nlattr *) b;
+ struct nlattr *nla = (struct nlattr *) skb_tail_pointer(skb);
struct tc_netem_qopt qopt;
struct tc_netem_corr cor;
struct tc_netem_reorder reorder;
@@ -590,12 +589,10 @@ static int netem_dump(struct Qdisc *sch, struct sk_buff *skb)
corrupt.correlation = q->corrupt_cor.rho;
NLA_PUT(skb, TCA_NETEM_CORRUPT, sizeof(corrupt), &corrupt);
- nla->nla_len = skb_tail_pointer(skb) - b;
-
- return skb->len;
+ return nla_nest_end(skb, nla);
nla_put_failure:
- nlmsg_trim(skb, b);
+ nlmsg_trim(skb, nla);
return -1;
}