Skip to content

Commit

Permalink
netem: cleanup dump code
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
stephen hemminger authored and David S. Miller committed Feb 25, 2011
1 parent 290f5e3 commit 861d7f7
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions net/sched/sch_netem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down

0 comments on commit 861d7f7

Please sign in to comment.