* [PATCH 10/11] IB/mlx5: Fix undefined behavior due to shift overflowing the constant
[not found] <20220405151517.29753-1-bp@alien8.de>
@ 2022-04-05 15:15 ` Borislav Petkov
2022-04-05 18:31 ` Leon Romanovsky
2022-04-06 7:17 ` Leon Romanovsky
0 siblings, 2 replies; 4+ messages in thread
From: Borislav Petkov @ 2022-04-05 15:15 UTC (permalink / raw)
To: LKML; +Cc: Leon Romanovsky, Saeed Mahameed, linux-rdma, netdev
From: Borislav Petkov <bp@suse.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@suse.de>
Cc: Leon Romanovsky <leon@kernel.org>
Cc: Saeed Mahameed <saeedm@nvidia.com>
Cc: linux-rdma@vger.kernel.org
Cc: netdev@vger.kernel.org
---
include/linux/mlx5/port.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 10/11] IB/mlx5: Fix undefined behavior due to shift overflowing the constant
2022-04-05 15:15 ` [PATCH 10/11] IB/mlx5: Fix undefined behavior due to shift overflowing the constant Borislav Petkov
@ 2022-04-05 18:31 ` Leon Romanovsky
2022-04-05 19:42 ` Borislav Petkov
2022-04-06 7:17 ` Leon Romanovsky
1 sibling, 1 reply; 4+ messages in thread
From: Leon Romanovsky @ 2022-04-05 18:31 UTC (permalink / raw)
To: Borislav Petkov
Cc: LKML, Saeed Mahameed, linux-rdma, netdev, Jason Gunthorpe,
Jakub Kicinski
On Tue, Apr 05, 2022 at 05:15:16PM +0200, Borislav Petkov wrote:
> From: Borislav Petkov <bp@suse.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@suse.de>
> Cc: Leon Romanovsky <leon@kernel.org>
> Cc: Saeed Mahameed <saeedm@nvidia.com>
> Cc: linux-rdma@vger.kernel.org
> Cc: netdev@vger.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
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 10/11] IB/mlx5: Fix undefined behavior due to shift overflowing the constant
2022-04-05 18:31 ` Leon Romanovsky
@ 2022-04-05 19:42 ` Borislav Petkov
0 siblings, 0 replies; 4+ messages in thread
From: Borislav Petkov @ 2022-04-05 19:42 UTC (permalink / raw)
To: Leon Romanovsky
Cc: LKML, Saeed Mahameed, linux-rdma, netdev, Jason Gunthorpe,
Jakub Kicinski
On Tue, Apr 05, 2022 at 09:31:16PM +0300, Leon Romanovsky wrote:
> I would like to take this patch to mlx5-next, but it didn't show
> nor in patchworks [1] nor in lore [2].
I'm investigating. I'll resend tomorrow if it hasn't appeared by then.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 10/11] IB/mlx5: Fix undefined behavior due to shift overflowing the constant
2022-04-05 15:15 ` [PATCH 10/11] IB/mlx5: Fix undefined behavior due to shift overflowing the constant Borislav Petkov
2022-04-05 18:31 ` Leon Romanovsky
@ 2022-04-06 7:17 ` Leon Romanovsky
1 sibling, 0 replies; 4+ messages in thread
From: Leon Romanovsky @ 2022-04-06 7:17 UTC (permalink / raw)
To: Borislav Petkov
Cc: LKML, Saeed Mahameed, linux-rdma, netdev, Jakub Kicinski,
Jason Gunthorpe
On Tue, Apr 05, 2022 at 05:15:16PM +0200, Borislav Petkov wrote:
> From: Borislav Petkov <bp@suse.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@suse.de>
> Cc: Leon Romanovsky <leon@kernel.org>
> Cc: Saeed Mahameed <saeedm@nvidia.com>
> Cc: linux-rdma@vger.kernel.org
> Cc: netdev@vger.kernel.org
> ---
> 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")
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-04-06 10:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20220405151517.29753-1-bp@alien8.de>
2022-04-05 15:15 ` [PATCH 10/11] IB/mlx5: Fix undefined behavior due to shift overflowing the constant Borislav Petkov
2022-04-05 18:31 ` Leon Romanovsky
2022-04-05 19:42 ` Borislav Petkov
2022-04-06 7:17 ` Leon Romanovsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox