Skip to contentSkip to conversation

RDMA/mlx5: Silence the overflow warning while building offset mask

PATCH Applied Leon Romanovsky 2 participants 2 messages Nov 25, 2020 – Nov 26, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RDMA/mlx5: Silence the overflow warning while building offset mask

From: Leon Romanovsky <[email protected]>

The coverity reports "Potentially overflowing expression ..." warning, which is correct thing to complain from the compiler point of view, but this is not possible in the current code.

Fixes b045db62f6f6 ("RDMA/mlx5: Use ib_umem_find_best_pgoff() for SRQ")
---
 drivers/infiniband/hw/mlx5/mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/mem.c +1 -1
index f8ec5156d8e9..844545064c9e 100644
@@ -62,7 +62,7 @@ unsigned long __mlx5_umem_find_best_quantized_pgoff(
 	unsigned int page_offset_bits, u64 pgoff_bitmask, unsigned int scale,
 	unsigned int *page_offset_quantized)
 {
-	const u64 page_offset_mask = (1 << page_offset_bits) - 1;
+	const u64 page_offset_mask = (1UL << page_offset_bits) - 1;
 	unsigned long page_size;
 	u64 page_offset;
 
Signature · 1 line
2.28.0
maintainer Applied
#1 lore raw
Quoted 11 lines · Leon Romanovsky

From: Leon Romanovsky <[email protected]>

The coverity reports "Potentially overflowing expression ..." warning, which is correct thing to complain from the compiler point of view, but this is not possible in the current code.

Fixes b045db62f6f6 ("RDMA/mlx5: Use ib_umem_find_best_pgoff() for SRQ")
---
 drivers/infiniband/hw/mlx5/mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to for-next, thanks

Jason