diff options
author | David S. Miller <davem@davemloft.net> | 2012-06-27 00:46:19 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-06-27 00:54:15 -0400 |
commit | 737100e1622360b3de10550a15faf095547d972a (patch) | |
tree | 44f2ef5e5d815d726b100858c8a902b7a3d08c75 /net | |
parent | c64e66c67b574f25a048886807c2007d17d50d0a (diff) |
decnet: dn_route: Move away from NLMSG_NEW().
And use nlmsg_data() while we're here too.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/decnet/dn_route.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index 586302e557ad..cd584f7de4dd 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c | |||
@@ -1518,8 +1518,10 @@ static int dn_rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, | |||
1518 | unsigned char *b = skb_tail_pointer(skb); | 1518 | unsigned char *b = skb_tail_pointer(skb); |
1519 | long expires; | 1519 | long expires; |
1520 | 1520 | ||
1521 | nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*r), flags); | 1521 | nlh = nlmsg_put(skb, pid, seq, event, sizeof(*r), flags); |
1522 | r = NLMSG_DATA(nlh); | 1522 | if (!nlh) |
1523 | goto out_nlmsg_trim; | ||
1524 | r = nlmsg_data(nlh); | ||
1523 | r->rtm_family = AF_DECnet; | 1525 | r->rtm_family = AF_DECnet; |
1524 | r->rtm_dst_len = 16; | 1526 | r->rtm_dst_len = 16; |
1525 | r->rtm_src_len = 0; | 1527 | r->rtm_src_len = 0; |
@@ -1559,7 +1561,7 @@ static int dn_rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, | |||
1559 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; | 1561 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; |
1560 | return skb->len; | 1562 | return skb->len; |
1561 | 1563 | ||
1562 | nlmsg_failure: | 1564 | out_nlmsg_trim: |
1563 | rtattr_failure: | 1565 | rtattr_failure: |
1564 | nlmsg_trim(skb, b); | 1566 | nlmsg_trim(skb, b); |
1565 | return -1; | 1567 | return -1; |
@@ -1572,7 +1574,7 @@ static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void | |||
1572 | { | 1574 | { |
1573 | struct net *net = sock_net(in_skb->sk); | 1575 | struct net *net = sock_net(in_skb->sk); |
1574 | struct rtattr **rta = arg; | 1576 | struct rtattr **rta = arg; |
1575 | struct rtmsg *rtm = NLMSG_DATA(nlh); | 1577 | struct rtmsg *rtm = nlmsg_data(nlh); |
1576 | struct dn_route *rt = NULL; | 1578 | struct dn_route *rt = NULL; |
1577 | struct dn_skb_cb *cb; | 1579 | struct dn_skb_cb *cb; |
1578 | int err; | 1580 | int err; |
@@ -1669,7 +1671,7 @@ int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
1669 | 1671 | ||
1670 | if (NLMSG_PAYLOAD(cb->nlh, 0) < sizeof(struct rtmsg)) | 1672 | if (NLMSG_PAYLOAD(cb->nlh, 0) < sizeof(struct rtmsg)) |
1671 | return -EINVAL; | 1673 | return -EINVAL; |
1672 | if (!(((struct rtmsg *)NLMSG_DATA(cb->nlh))->rtm_flags&RTM_F_CLONED)) | 1674 | if (!(((struct rtmsg *)nlmsg_data(cb->nlh))->rtm_flags&RTM_F_CLONED)) |
1673 | return 0; | 1675 | return 0; |
1674 | 1676 | ||
1675 | s_h = cb->args[0]; | 1677 | s_h = cb->args[0]; |