aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorNicolas Dichtel <nicolas.dichtel@6wind.com>2016-04-21 18:58:25 +0200
committerDavid S. Miller <davem@davemloft.net>2016-04-21 14:22:13 -0400
commit58414d32a37e4c2f79da91aebc2d2365918a1562 (patch)
tree6ec1febdc87b7aed86e4f5c01e92cfe77c580f2c /net
parentlibnl: add more helpers to align attributes on 64-bit (diff)
downloadlinux-dev-58414d32a37e4c2f79da91aebc2d2365918a1562.tar.xz
linux-dev-58414d32a37e4c2f79da91aebc2d2365918a1562.zip
rtnl: use the new API to align IFLA_STATS*
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/core/rtnetlink.c22
1 files changed, 5 insertions, 17 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 4a47a9aceb1d..5ec059d52823 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1051,14 +1051,9 @@ static noinline_for_stack int rtnl_fill_stats(struct sk_buff *skb,
{
struct rtnl_link_stats64 *sp;
struct nlattr *attr;
- int err;
-
- err = nla_align_64bit(skb, IFLA_PAD);
- if (err)
- return err;
- attr = nla_reserve(skb, IFLA_STATS64,
- sizeof(struct rtnl_link_stats64));
+ attr = nla_reserve_64bit(skb, IFLA_STATS64,
+ sizeof(struct rtnl_link_stats64), IFLA_PAD);
if (!attr)
return -EMSGSIZE;
@@ -3469,17 +3464,10 @@ static int rtnl_fill_statsinfo(struct sk_buff *skb, struct net_device *dev,
if (filter_mask & IFLA_STATS_FILTER_BIT(IFLA_STATS_LINK_64)) {
struct rtnl_link_stats64 *sp;
- int err;
-
- /* if necessary, add a zero length NOP attribute so that
- * IFLA_STATS_LINK_64 will be 64-bit aligned
- */
- err = nla_align_64bit(skb, IFLA_STATS_UNSPEC);
- if (err)
- goto nla_put_failure;
- attr = nla_reserve(skb, IFLA_STATS_LINK_64,
- sizeof(struct rtnl_link_stats64));
+ attr = nla_reserve_64bit(skb, IFLA_STATS_LINK_64,
+ sizeof(struct rtnl_link_stats64),
+ IFLA_STATS_UNSPEC);
if (!attr)
goto nla_put_failure;