OSDN Git Service

net/mlx5e: reduce stack usage in mlx5_eswitch_termtbl_create
authorArnd Bergmann <arnd@arndb.de>
Tue, 18 Jun 2019 11:15:06 +0000 (13:15 +0200)
committerSaeed Mahameed <saeedm@mellanox.com>
Fri, 28 Jun 2019 23:03:59 +0000 (16:03 -0700)
commit5233794b179136d597b84188c1285148f07012e6
tree692403786274b37ba322ef93950bcc9f54cff405
parentf72e6c3e17be568138d8e4855ac2734d251a6913
net/mlx5e: reduce stack usage in mlx5_eswitch_termtbl_create

Putting an empty 'mlx5_flow_spec' structure on the stack is a bit
wasteful and causes a warning on 32-bit architectures when building
with clang -fsanitize-coverage:

drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtbl.c: In function 'mlx5_eswitch_termtbl_create':
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtbl.c:90:1: error: the frame size of 1032 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]

Since the structure is never written to, we can statically allocate
it to avoid the stack usage. To be on the safe side, mark all
subsequent function arguments that we pass it into as 'const'
as well.

Fixes: 10caabdaad5a ("net/mlx5e: Use termination table for VLAN push actions")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Saeed Mahameed <saeedm@mellanox.com>
Acked-by: Mark Bloch <markb@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtbl.c
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
include/linux/mlx5/fs.h