[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230622101525.3321642-1-arnd@kernel.org>
Date: Thu, 22 Jun 2023 12:15:02 +0200
From: Arnd Bergmann <arnd@...nel.org>
To: Saeed Mahameed <saeedm@...dia.com>,
Leon Romanovsky <leon@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>
Cc: Arnd Bergmann <arnd@...db.de>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Tom Rix <trix@...hat.com>,
Tariq Toukan <tariqt@...dia.com>,
Maxim Mikityanskiy <maxtram95@...il.com>,
Adham Faris <afaris@...dia.com>,
netdev@...r.kernel.org,
linux-rdma@...r.kernel.org,
linux-kernel@...r.kernel.org,
llvm@...ts.linux.dev
Subject: [PATCH] mlx5: avoid integer overflow warning for large page size
From: Arnd Bergmann <arnd@...db.de>
Build testing with 'make LLVM=1 W=1' shows a warning about a
condition that is always true on configurations with 64KB
pages:
drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c:32:22: error: result of comparison of constant 65536 with expression of type 'u16' (aka 'unsigned short') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
Change the condition in a way that lets clang know this
is intentional.
Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c
index 36826b5824847..b9f62e531bd4c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c
@@ -29,7 +29,8 @@ bool mlx5e_validate_xsk_param(struct mlx5e_params *params,
struct mlx5_core_dev *mdev)
{
/* AF_XDP doesn't support frames larger than PAGE_SIZE. */
- if (xsk->chunk_size > PAGE_SIZE || xsk->chunk_size < MLX5E_MIN_XSK_CHUNK_SIZE) {
+ if ((PAGE_SIZE < U16_MAX && xsk->chunk_size > PAGE_SIZE)
+ || xsk->chunk_size < MLX5E_MIN_XSK_CHUNK_SIZE) {
mlx5_core_err(mdev, "XSK chunk size %u out of bounds [%u, %lu]\n", xsk->chunk_size,
MLX5E_MIN_XSK_CHUNK_SIZE, PAGE_SIZE);
return false;
--
2.39.2
Powered by blists - more mailing lists