Closed GustavoARSilva closed 4 years ago
When replacing the one-element array reserved_at_5f[1] with a flexible-array member in struct mlx5_ifc_pcmr_reg_bits:
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h index 6b22e5a96f10..cbeef8a7b690 100644 --- a/include/linux/mlx5/mlx5_ifc.h +++ b/include/linux/mlx5/mlx5_ifc.h @@ -9219,7 +9219,7 @@ struct mlx5_ifc_pcmr_reg_bits { u8 entropy_gre_calc[0x1]; u8 reserved_at_43[0x1b]; u8 fcs_chk[0x1]; - u8 reserved_at_5f[0x1]; + u8 reserved_at_5f[]; }; struct mlx5_ifc_lane_2_module_mapping_bits {
the following error shows up:
from drivers/net/ethernet/mellanox/mlx5/core/port.c:33: drivers/net/ethernet/mellanox/mlx5/core/port.c: In function ‘mlx5_query_ports_check’: ./include/linux/compiler.h:394:38: error: call to ‘__compiletime_assert_775’ declared with attribute error: BUILD_BUG_ON failed: __mlx5_st_sz_bits(pcmr_reg) % 32 394 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | ^ ./include/linux/compiler.h:375:4: note: in definition of macro ‘__compiletime_assert’ 375 | prefix ## suffix(); \ | ^~~~~~ ./include/linux/compiler.h:394:2: note: in expansion of macro ‘_compiletime_assert’ 394 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | ^~~~~~~~~~~~~~~~~~~ ./include/linux/build_bug.h:39:37: note: in expansion of macro ‘compiletime_assert’ 39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | ^~~~~~~~~~~~~~~~~~ ./include/linux/build_bug.h:50:2: note: in expansion of macro ‘BUILD_BUG_ON_MSG’ 50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition) | ^~~~~~~~~~~~~~~~ ./include/linux/mlx5/device.h:75:2: note: in expansion of macro ‘BUILD_BUG_ON’ 75 | BUILD_BUG_ON(__mlx5_st_sz_bits(typ) % 32); \ | ^~~~~~~~~~~~ drivers/net/ethernet/mellanox/mlx5/core/port.c:794:2: note: in expansion of macro ‘MLX5_SET’ 794 | MLX5_SET(pcmr_reg, in, local_port, 1); | ^~~~~~~~ drivers/net/ethernet/mellanox/mlx5/core/port.c: In function ‘mlx5_set_port_fcs’: ./include/linux/compiler.h:394:38: error: call to ‘__compiletime_assert_776’ declared with attribute error: BUILD_BUG_ON failed: __mlx5_st_sz_bits(pcmr_reg) % 32 394 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | ^ ./include/linux/compiler.h:375:4: note: in definition of macro ‘__compiletime_assert’ 375 | prefix ## suffix(); \ | ^~~~~~ ./include/linux/compiler.h:394:2: note: in expansion of macro ‘_compiletime_assert’ 394 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | ^~~~~~~~~~~~~~~~~~~ ./include/linux/build_bug.h:39:37: note: in expansion of macro ‘compiletime_assert’ 39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | ^~~~~~~~~~~~~~~~~~ ./include/linux/build_bug.h:50:2: note: in expansion of macro ‘BUILD_BUG_ON_MSG’ 50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition) | ^~~~~~~~~~~~~~~~ ./include/linux/mlx5/device.h:75:2: note: in expansion of macro ‘BUILD_BUG_ON’ 75 | BUILD_BUG_ON(__mlx5_st_sz_bits(typ) % 32); \ | ^~~~~~~~~~~~ drivers/net/ethernet/mellanox/mlx5/core/port.c:815:2: note: in expansion of macro ‘MLX5_SET’ 815 | MLX5_SET(pcmr_reg, in, local_port, 1); | ^~~~~~~~ ./include/linux/compiler.h:394:38: error: call to ‘__compiletime_assert_777’ declared with attribute error: BUILD_BUG_ON failed: __mlx5_st_sz_bits(pcmr_reg) % 32 394 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | ^ ./include/linux/compiler.h:375:4: note: in definition of macro ‘__compiletime_assert’ 375 | prefix ## suffix(); \ | ^~~~~~ ./include/linux/compiler.h:394:2: note: in expansion of macro ‘_compiletime_assert’ 394 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | ^~~~~~~~~~~~~~~~~~~ ./include/linux/build_bug.h:39:37: note: in expansion of macro ‘compiletime_assert’ 39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | ^~~~~~~~~~~~~~~~~~ ./include/linux/build_bug.h:50:2: note: in expansion of macro ‘BUILD_BUG_ON_MSG’ 50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition) | ^~~~~~~~~~~~~~~~ ./include/linux/mlx5/device.h:75:2: note: in expansion of macro ‘BUILD_BUG_ON’ 75 | BUILD_BUG_ON(__mlx5_st_sz_bits(typ) % 32); \ | ^~~~~~~~~~~~ drivers/net/ethernet/mellanox/mlx5/core/port.c:816:2: note: in expansion of macro ‘MLX5_SET’ 816 | MLX5_SET(pcmr_reg, in, fcs_chk, enable); | ^~~~~~~~ scripts/Makefile.build:272: recipe for target 'drivers/net/ethernet/mellanox/mlx5/core/port.o' failed
See flexible-array conversions issue.
Duplicate of https://github.com/KSPP/linux/issues/65
When replacing the one-element array reserved_at_5f[1] with a flexible-array member in struct mlx5_ifc_pcmr_reg_bits:
the following error shows up:
See flexible-array conversions issue.