From 923e1cb4e525bb3d6dd9c72a2821f924794ef570 Mon Sep 17 00:00:00 2001 From: Alexander Chesnokov Date: Thu, 9 Jul 2026 08:03:27 +0300 Subject: [PATCH] RDMA/hns: Compute HEM index in 64-bit in hns_roce_v2_set_hem() In hns_roce_v2_set_hem() the HEM address indices are computed from i, j and k (the base-chunk_ba_num decomposition of the 32-bit table_idx) in 32-bit arithmetic and then assigned to u64 fields. The recombined value always equals table_idx and cannot exceed U32_MAX, so this is not a reachable overflow and has no user-visible impact. Declare i, j and k as u64 so the calculation is done in 64-bit and the pattern no longer trips static analyzers. No functional change intended. Found by Linux Verification Center (linuxtesting.org) with SVACE. Suggested-by: David Laight Signed-off-by: Alexander Chesnokov Link: https://patch.msgid.link/20260709050327.3547237-1-Alexander.Chesnokov@kaspersky.com Signed-off-by: Leon Romanovsky --- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c index 2b3a1cafd1b2..27cc7df55ee7 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c @@ -4393,7 +4393,7 @@ static int hns_roce_v2_set_hem(struct hns_roce_dev *hr_dev, struct hns_roce_hem_mhop mhop; struct hns_roce_hem *hem; unsigned long mhop_obj = obj; - int i, j, k; + u64 i, j, k; int ret = 0; u64 hem_idx = 0; u64 l1_idx = 0;