Commit a050c33f authored by Daniel Lezcano's avatar Daniel Lezcano Committed by David S. Miller

[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: default avatarBenjamin Thery <benjamin.thery@bull.net>
Signed-off-by: default avatarDaniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent abf07acb
...@@ -41,7 +41,8 @@ ...@@ -41,7 +41,8 @@
#include <linux/dmaengine.h> #include <linux/dmaengine.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
struct net; #include <net/net_namespace.h>
struct vlan_group; struct vlan_group;
struct ethtool_ops; struct ethtool_ops;
struct netpoll_info; struct netpoll_info;
...@@ -753,23 +754,21 @@ extern rwlock_t dev_base_lock; /* Device list lock */ ...@@ -753,23 +754,21 @@ extern rwlock_t dev_base_lock; /* Device list lock */
list_for_each_entry_continue(d, &(net)->dev_base_head, dev_list) list_for_each_entry_continue(d, &(net)->dev_base_head, dev_list)
#define net_device_entry(lh) list_entry(lh, struct net_device, dev_list) #define net_device_entry(lh) list_entry(lh, struct net_device, dev_list)
#define next_net_device(d) \ static inline struct net_device *next_net_device(struct net_device *dev)
({ \ {
struct net_device *dev = d; \ struct list_head *lh;
struct list_head *lh; \ struct net *net;
struct net *net; \
\ net = dev->nd_net;
net = dev->nd_net; \ lh = dev->dev_list.next;
lh = dev->dev_list.next; \ return lh == &net->dev_base_head ? NULL : net_device_entry(lh);
lh == &net->dev_base_head ? NULL : net_device_entry(lh); \ }
})
static inline struct net_device *first_net_device(struct net *net)
#define first_net_device(N) \ {
({ \ return list_empty(&net->dev_base_head) ? NULL :
struct net *NET = (N); \ net_device_entry(net->dev_base_head.next);
list_empty(&NET->dev_base_head) ? NULL : \ }
net_device_entry(NET->dev_base_head.next); \
})
extern int netdev_boot_setup_check(struct net_device *dev); extern int netdev_boot_setup_check(struct net_device *dev);
extern unsigned long netdev_boot_base(const char *prefix, int unit); extern unsigned long netdev_boot_base(const char *prefix, int unit);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment