[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YkyK9NfN57ldFuyY@unreal>
Date: Tue, 5 Apr 2022 21:31:16 +0300
From: Leon Romanovsky <leon@...nel.org>
To: Borislav Petkov <bp@...en8.de>
Cc: LKML <linux-kernel@...r.kernel.org>,
Saeed Mahameed <saeedm@...dia.com>, linux-rdma@...r.kernel.org,
netdev@...r.kernel.org, Jason Gunthorpe <jgg@...dia.com>,
Jakub Kicinski <kuba@...nel.org>
Subject: Re: [PATCH 10/11] IB/mlx5: Fix undefined behavior due to shift
overflowing the constant
On Tue, Apr 05, 2022 at 05:15:16PM +0200, Borislav Petkov wrote:
> From: Borislav Petkov <bp@...e.de>
>
> 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@zn.tnic for the gory
> details as to why it triggers with older gccs only.
>
> Signed-off-by: Borislav Petkov <bp@...e.de>
> Cc: Leon Romanovsky <leon@...nel.org>
> Cc: Saeed Mahameed <saeedm@...dia.com>
> Cc: linux-rdma@...r.kernel.org
> Cc: netdev@...r.kernel.org
> ---
> include/linux/mlx5/port.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
I would like to take this patch to mlx5-next, but it didn't show
nor in patchworks [1] nor in lore [2].
Thanks
[1] https://patchwork.kernel.org/project/linux-rdma/list/
[2] https://lore.kernel.org/linux-rdma/
>
> diff --git a/include/linux/mlx5/port.h b/include/linux/mlx5/port.h
> index 28a928b0684b..e96ee1e348cb 100644
> --- a/include/linux/mlx5/port.h
> +++ b/include/linux/mlx5/port.h
> @@ -141,7 +141,7 @@ enum mlx5_ptys_width {
> MLX5_PTYS_WIDTH_12X = 1 << 4,
> };
>
> -#define MLX5E_PROT_MASK(link_mode) (1 << link_mode)
> +#define MLX5E_PROT_MASK(link_mode) (1U << link_mode)
> #define MLX5_GET_ETH_PROTO(reg, out, ext, field) \
> (ext ? MLX5_GET(reg, out, ext_##field) : \
> MLX5_GET(reg, out, field))
> --
> 2.35.1
>
Powered by blists - more mailing lists