Re: [PATCH 10/11] IB/mlx5: Fix undefined behavior due to shift overflowing the constant

From: Leon Romanovsky
Date: Wed Apr 06 2022 - 06:54:36 EST


On Tue, Apr 05, 2022 at 05:15:16PM +0200, Borislav Petkov wrote:
> From: Borislav Petkov <bp@xxxxxxx>
>
> Fix:
>
> drivers/infiniband/hw/mlx5/main.c: In function ‘translate_eth_legacy_proto_oper’:
> drivers/infiniband/hw/mlx5/main.c:370:2: error: case label does not reduce to an integer constant
> case MLX5E_PROT_MASK(MLX5E_50GBASE_KR2):
> ^~~~
>
> See https://lore.kernel.org/r/YkwQ6%2BtIH8GQpuct@xxxxxxx for the gory
> details as to why it triggers with older gccs only.
>
> Signed-off-by: Borislav Petkov <bp@xxxxxxx>
> Cc: Leon Romanovsky <leon@xxxxxxxxxx>
> Cc: Saeed Mahameed <saeedm@xxxxxxxxxx>
> Cc: linux-rdma@xxxxxxxxxxxxxxx
> Cc: netdev@xxxxxxxxxxxxxxx
> ---
> include/linux/mlx5/port.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

Thanks, applied to mlx5-next.

0276bd3a94c0 ("IB/mlx5: Fix undefined behavior due to shift overflowing the constant")