diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2008-05-21 17:12:46 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-05-21 17:12:46 -0400 |
commit | 96e74088f1da4d9a53735a4a57a4f984f86b75c6 (patch) | |
tree | 4c645107e3b75694ac142b562e221a868d3ccb89 /net | |
parent | 34ac2573e88c4f80fc5e219d8012ea383a788803 (diff) |
net: The dev->get_stats pointer is not NULL nowadays.
And so does the pointer is returns, but sysfs and netlinks still
check for both cases.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/net-sysfs.c | 9 | ||||
-rw-r--r-- | net/core/rtnetlink.c | 20 |
2 files changed, 12 insertions, 17 deletions
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 90e2177af081..dccd737ea2e3 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c | |||
@@ -242,11 +242,11 @@ static ssize_t netstat_show(const struct device *d, | |||
242 | offset % sizeof(unsigned long) != 0); | 242 | offset % sizeof(unsigned long) != 0); |
243 | 243 | ||
244 | read_lock(&dev_base_lock); | 244 | read_lock(&dev_base_lock); |
245 | if (dev_isalive(dev) && dev->get_stats && | 245 | if (dev_isalive(dev)) { |
246 | (stats = (*dev->get_stats)(dev))) | 246 | stats = dev->get_stats(dev); |
247 | ret = sprintf(buf, fmt_ulong, | 247 | ret = sprintf(buf, fmt_ulong, |
248 | *(unsigned long *)(((u8 *) stats) + offset)); | 248 | *(unsigned long *)(((u8 *) stats) + offset)); |
249 | 249 | } | |
250 | read_unlock(&dev_base_lock); | 250 | read_unlock(&dev_base_lock); |
251 | return ret; | 251 | return ret; |
252 | } | 252 | } |
@@ -457,8 +457,7 @@ int netdev_register_kobject(struct net_device *net) | |||
457 | strlcpy(dev->bus_id, net->name, BUS_ID_SIZE); | 457 | strlcpy(dev->bus_id, net->name, BUS_ID_SIZE); |
458 | 458 | ||
459 | #ifdef CONFIG_SYSFS | 459 | #ifdef CONFIG_SYSFS |
460 | if (net->get_stats) | 460 | *groups++ = &netstat_group; |
461 | *groups++ = &netstat_group; | ||
462 | 461 | ||
463 | #ifdef CONFIG_WIRELESS_EXT | 462 | #ifdef CONFIG_WIRELESS_EXT |
464 | if (net->wireless_handlers && net->wireless_handlers->get_wireless_stats) | 463 | if (net->wireless_handlers && net->wireless_handlers->get_wireless_stats) |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index cf857c4dc7b1..ca32ddb8ad17 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -606,6 +606,8 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev, | |||
606 | { | 606 | { |
607 | struct ifinfomsg *ifm; | 607 | struct ifinfomsg *ifm; |
608 | struct nlmsghdr *nlh; | 608 | struct nlmsghdr *nlh; |
609 | struct net_device_stats *stats; | ||
610 | struct nlattr *attr; | ||
609 | 611 | ||
610 | nlh = nlmsg_put(skb, pid, seq, type, sizeof(*ifm), flags); | 612 | nlh = nlmsg_put(skb, pid, seq, type, sizeof(*ifm), flags); |
611 | if (nlh == NULL) | 613 | if (nlh == NULL) |
@@ -652,19 +654,13 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev, | |||
652 | NLA_PUT(skb, IFLA_BROADCAST, dev->addr_len, dev->broadcast); | 654 | NLA_PUT(skb, IFLA_BROADCAST, dev->addr_len, dev->broadcast); |
653 | } | 655 | } |
654 | 656 | ||
655 | if (dev->get_stats) { | 657 | attr = nla_reserve(skb, IFLA_STATS, |
656 | struct net_device_stats *stats = dev->get_stats(dev); | 658 | sizeof(struct rtnl_link_stats)); |
657 | if (stats) { | 659 | if (attr == NULL) |
658 | struct nlattr *attr; | 660 | goto nla_put_failure; |
659 | 661 | ||
660 | attr = nla_reserve(skb, IFLA_STATS, | 662 | stats = dev->get_stats(dev); |
661 | sizeof(struct rtnl_link_stats)); | 663 | copy_rtnl_link_stats(nla_data(attr), stats); |
662 | if (attr == NULL) | ||
663 | goto nla_put_failure; | ||
664 | |||
665 | copy_rtnl_link_stats(nla_data(attr), stats); | ||
666 | } | ||
667 | } | ||
668 | 664 | ||
669 | if (dev->rtnl_link_ops) { | 665 | if (dev->rtnl_link_ops) { |
670 | if (rtnl_link_fill(skb, dev) < 0) | 666 | if (rtnl_link_fill(skb, dev) < 0) |