[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87tvzow42d.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me>
Date: Wed, 27 Sep 2017 11:31:54 -0400
From: Vivien Didelot <vivien.didelot@...oirfairelinux.com>
To: Andrew Lunn <andrew@...n.ch>, David Miller <davem@...emloft.net>
Cc: netdev <netdev@...r.kernel.org>, Andrew Lunn <andrew@...n.ch>
Subject: Re: [PATCH net-next 1/6] net: dsa: Fix SWITCHDEV_ATTR_ID_PORT_PARENT_ID
Hi Andrew,
Andrew Lunn <andrew@...n.ch> writes:
> @@ -354,13 +354,16 @@ static int dsa_slave_port_attr_get(struct net_device *dev,
> struct switchdev_attr *attr)
> {
> struct dsa_slave_priv *p = netdev_priv(dev);
> - struct dsa_switch *ds = p->dp->ds;
>
> switch (attr->id) {
> - case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
> - attr->u.ppid.id_len = sizeof(ds->index);
> - memcpy(&attr->u.ppid.id, &ds->index, attr->u.ppid.id_len);
> + case SWITCHDEV_ATTR_ID_PORT_PARENT_ID: {
> + struct dsa_switch *ds = p->dp->ds;
> + struct dsa_switch_tree *dst = ds->dst;
> +
> + attr->u.ppid.id_len = sizeof(dst->tree);
> + memcpy(&attr->u.ppid.id, &dst->tree, sizeof(dst->tree));
> break;
> + }
> case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT:
> attr->u.brport_flags_support = 0;
> break;
I am pretty sure the kernel folks won't like blocks within case
statments. Simply declare dst = p->dp->ds->dst at the beginning.
Also keeping attr->u.ppid.id_len as memcpy's third argument like other
switchdev users do would be prefered.
Otherwise using the tree index is indeed the way to go:
Reviewed-by: Vivien Didelot <vivien.didelot@...oirfairelinux.com>
Thanks,
Vivien
Powered by blists - more mailing lists