* [PATCH] RDMA/i40iw: Fix 32-bit overflow in i40iw_check_mem_contiguous()
@ 2025-08-20 11:28 Ivan Stepchenko
0 siblings, 0 replies; only message in thread
From: Ivan Stepchenko @ 2025-08-20 11:28 UTC (permalink / raw)
To: Mustafa Ismail
Cc: Ivan Stepchenko, Tatyana Nikolova, Jason Gunthorpe,
Leon Romanovsky, Shannon Nelson, Anjali Singhai Jain,
Faisal Latif, Doug Ledford, linux-rdma, linux-kernel,
lvc-project
pg_size and pg_idx are u32, so pg_size * pg_idx is computed in 32-bit
and wraps once the total offset reaches 4 GiB (e.g. 2 MiB pages at
pg_idx == 2048). The wrapped offset is then widened to u64, producing
a false negative: contiguous PBL entries are incorrectly reported
as non-contiguous.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: b48c24c2d710 ("RDMA/irdma: Implement device supported verb APIs")
Signed-off-by: Ivan Stepchenko <sid@itb.spb.ru>
---
drivers/infiniband/hw/irdma/verbs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c
index da5a41b275d8..33831cd3ce1f 100644
--- a/drivers/infiniband/hw/irdma/verbs.c
+++ b/drivers/infiniband/hw/irdma/verbs.c
@@ -2366,7 +2366,7 @@ static bool irdma_check_mem_contiguous(u64 *arr, u32 npages, u32 pg_size)
u32 pg_idx;
for (pg_idx = 0; pg_idx < npages; pg_idx++) {
- if ((*arr + (pg_size * pg_idx)) != arr[pg_idx])
+ if ((*arr + ((u64)pg_size * pg_idx)) != arr[pg_idx])
return false;
}
--
2.39.5
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-08-20 11:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-20 11:28 [PATCH] RDMA/i40iw: Fix 32-bit overflow in i40iw_check_mem_contiguous() Ivan Stepchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®