Re: [patch net-next RFC 07/12] dsa: implement ndo_swdev_get_id
From: Ben Hutchings <hidden>
Date: 2014-08-21 16:38:32
Attachments
- signature.asc [application/pgp-signature] 811 bytes
From: Ben Hutchings <hidden>
Date: 2014-08-21 16:38:32
On Thu, 2014-08-21 at 18:19 +0200, Jiri Pirko wrote: [...]
--- a/net/dsa/slave.c +++ b/net/dsa/slave.c@@ -171,6 +171,19 @@ static int dsa_slave_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) return -EOPNOTSUPP; } +static int dsa_slave_swdev_get_id(struct net_device *dev, + struct netdev_phys_item_id *psid) +{ + struct dsa_slave_priv *p = netdev_priv(dev); + struct dsa_switch *ds = p->parent; + u64 tmp = (u64) ds; + + /* TODO: add more sophisticated id generation */ + memcpy(&psid->id, &tmp, sizeof(tmp));
[...] Right, you must not expose kernel addresses to userland. Ben. -- Ben Hutchings If at first you don't succeed, you're doing about average.