diff options
author | Daniel Lezcano <dlezcano@fr.ibm.com> | 2007-09-12 08:57:09 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:49:18 -0400 |
commit | a050c33f4a4d5babaf94a8ba6ae7a200135240b3 (patch) | |
tree | d47e7be9cb38e277e767601926e11a432dd86c39 | |
parent | abf07acbb9f122218095d0d221e0f949160ccc37 (diff) |
[NETNS]: Fix bad macro definition.
The macro definition is bad. When calling next_net_device with
parameter name "dev", the resulting code is:
struct net_device *dev = dev and that leads to an unexpected
behavior. Especially when llc_core is compiled in, the kernel panics
at boot time.
The patchset change macro definition with static inline functions as
they were defined before.
Signed-off-by: Benjamin Thery <benjamin.thery@bull.net>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/linux/netdevice.h | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 407658c64fb6..625240ce27f1 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -41,7 +41,8 @@ | |||
41 | #include <linux/dmaengine.h> | 41 | #include <linux/dmaengine.h> |
42 | #include <linux/workqueue.h> | 42 | #include <linux/workqueue.h> |
43 | 43 | ||
44 | struct net; | 44 | #include <net/net_namespace.h> |
45 | |||
45 | struct vlan_group; | 46 | struct vlan_group; |
46 | struct ethtool_ops; | 47 | struct ethtool_ops; |
47 | struct netpoll_info; | 48 | struct netpoll_info; |
@@ -753,23 +754,21 @@ extern rwlock_t dev_base_lock; /* Device list lock */ | |||
753 | list_for_each_entry_continue(d, &(net)->dev_base_head, dev_list) | 754 | list_for_each_entry_continue(d, &(net)->dev_base_head, dev_list) |
754 | #define net_device_entry(lh) list_entry(lh, struct net_device, dev_list) | 755 | #define net_device_entry(lh) list_entry(lh, struct net_device, dev_list) |
755 | 756 | ||
756 | #define next_net_device(d) \ | 757 | static inline struct net_device *next_net_device(struct net_device *dev) |
757 | ({ \ | 758 | { |
758 | struct net_device *dev = d; \ | 759 | struct list_head *lh; |
759 | struct list_head *lh; \ | 760 | struct net *net; |
760 | struct net *net; \ | 761 | |
761 | \ | 762 | net = dev->nd_net; |
762 | net = dev->nd_net; \ | 763 | lh = dev->dev_list.next; |
763 | lh = dev->dev_list.next; \ | 764 | return lh == &net->dev_base_head ? NULL : net_device_entry(lh); |
764 | lh == &net->dev_base_head ? NULL : net_device_entry(lh); \ | 765 | } |
765 | }) | 766 | |
766 | 767 | static inline struct net_device *first_net_device(struct net *net) | |
767 | #define first_net_device(N) \ | 768 | { |
768 | ({ \ | 769 | return list_empty(&net->dev_base_head) ? NULL : |
769 | struct net *NET = (N); \ | 770 | net_device_entry(net->dev_base_head.next); |
770 | list_empty(&NET->dev_base_head) ? NULL : \ | 771 | } |
771 | net_device_entry(NET->dev_base_head.next); \ | ||
772 | }) | ||
773 | 772 | ||
774 | extern int netdev_boot_setup_check(struct net_device *dev); | 773 | extern int netdev_boot_setup_check(struct net_device *dev); |
775 | extern unsigned long netdev_boot_base(const char *prefix, int unit); | 774 | extern unsigned long netdev_boot_base(const char *prefix, int unit); |