]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
RDMA/hns: Fix the overflow risk of hem_list_calc_ba_range()
authorwenglianfa <wenglianfa@huawei.com>
Fri, 6 Sep 2024 09:34:39 +0000 (17:34 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Oct 2024 13:11:02 +0000 (15:11 +0200)
commitb79ddb93ec6799851598dac7bf4b97e8ad71faf3
treeb822806876f8f086c879107995f365db74e8b737
parent15bcd2dc26d7cb368e8dc93b4e5152f7f3fded33
RDMA/hns: Fix the overflow risk of hem_list_calc_ba_range()

[ Upstream commit d586628b169d14bbf36be64d2b3ec9d9d2fe0432 ]

The max value of 'unit' and 'hop_num' is 2^24 and 2, so the value of
'step' may exceed the range of u32. Change the type of 'step' to u64.

Fixes: 38389eaa4db1 ("RDMA/hns: Add mtr support for mixed multihop addressing")
Signed-off-by: wenglianfa <wenglianfa@huawei.com>
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Link: https://patch.msgid.link/20240906093444.3571619-5-huangjunxian6@hisilicon.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/hw/hns/hns_roce_hem.c