[ovs-dev] [patch net-next RFC 07/12] dsa: implement ndo_swdev_get_id

Ben Hutchings ben at decadent.org.uk
Fri Aug 22 17:28:04 UTC 2014


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.



More information about the dev mailing list