mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-19 07:39:54 +02:00
RDMA/hns: Fix undifined behavior caused by invalid max_sge
[ Upstream commit36397b9073
] If max_sge has been set to 0, roundup_pow_of_two() in set_srq_basic_param() may have undefined behavior. Fixes:9dd052474a
("RDMA/hns: Allocate one more recv SGE for HIP08") Signed-off-by: Chengchang Tang <tangchengchang@huawei.com> Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com> Link: https://lore.kernel.org/r/20240710133705.896445-7-huangjunxian6@hisilicon.com Signed-off-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
b47c078787
commit
7bf1e00d95
|
@ -296,7 +296,7 @@ static int set_srq_basic_param(struct hns_roce_srq *srq,
|
|||
|
||||
max_sge = proc_srq_sge(hr_dev, srq, !!udata);
|
||||
if (attr->max_wr > hr_dev->caps.max_srq_wrs ||
|
||||
attr->max_sge > max_sge) {
|
||||
attr->max_sge > max_sge || !attr->max_sge) {
|
||||
ibdev_err(&hr_dev->ib_dev,
|
||||
"invalid SRQ attr, depth = %u, sge = %u.\n",
|
||||
attr->max_wr, attr->max_sge);
|
||||
|
|
Loading…
Reference in New Issue
Block a user