]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
RDMA/hns: Fix signed-unsigned mixed comparisons
authorChengchang Tang <tangchengchang@huawei.com>
Tue, 17 Oct 2023 12:52:35 +0000 (20:52 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 Nov 2023 10:08:23 +0000 (11:08 +0100)
commit9f8db02d30ad0cf6ad144242b6ffabb3b137a3e3
tree9d2c144162129343bbd430f4a78f630205625897
parent2de683e27e1d85961fd9bffeaa28c1dd03903f54
RDMA/hns: Fix signed-unsigned mixed comparisons

[ Upstream commit b5f9efff101b06fd06a5e280a2b00b1335f5f476 ]

The ib_mtu_enum_to_int() and uverbs_attr_get_len() may returns a negative
value. In this case, mixed comparisons of signed and unsigned types will
throw wrong results.

This patch adds judgement for this situation.

Fixes: 30b707886aeb ("RDMA/hns: Support inline data in extented sge space for RC")
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Link: https://lore.kernel.org/r/20231017125239.164455-4-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_hw_v2.c