diff options
author | Petr Machata <petrm@mellanox.com> | 2018-11-22 23:28:07 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-11-23 18:02:23 -0800 |
commit | ec394af5ea1d8ee62681815d167115ac618bcb42 (patch) | |
tree | 903a86beef9400399b38992e84e56f6587a0f1b4 /net/switchdev | |
parent | 2eb487c1cf3d93b3863c1d0987d7a0e1fbd98a4d (diff) |
switchdev: SWITCHDEV_OBJ_PORT_{VLAN, MDB}(): Sanitize
The two macros SWITCHDEV_OBJ_PORT_VLAN() and SWITCHDEV_OBJ_PORT_MDB()
expand to a container_of() call, yielding an appropriate container of
their sole argument. However, due to a name collision, the first
argument, i.e. the contained object pointer, is not the only one to get
expanded. The third argument, which is a structure member name, and
should be kept literal, gets expanded as well. The only safe way to use
these two macros is therefore to name the local variable passed to them
"obj".
To fix this, rename the sole argument of the two macros from
"obj" (which collides with the member name) to "OBJ". Additionally,
instead of passing "OBJ" to container_of() verbatim, parenthesize it, so
that a comma in the passed-in expression doesn't pollute the
container_of() invocation.
Signed-off-by: Petr Machata <petrm@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/switchdev')
0 files changed, 0 insertions, 0 deletions