mirror of
https://kernel.googlesource.com/pub/scm/linux/kernel/git/stable/linux-stable.git
synced 2025-10-27 18:20:10 +10:00
RDMA/hns: Fix -Wframe-larger-than issue
[ Upstream commit79d56805c5] Fix -Wframe-larger-than issue by allocating memory for qpc struct with kzalloc() instead of using stack memory. Fixes:606bf89e98("RDMA/hns: Refactor for hns_roce_v2_modify_qp function") Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202506240032.CSgIyFct-lkp@intel.com/ Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com> Link: https://patch.msgid.link/20250703113905.3597124-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
20c0ed8dd6
commit
b6fbac6ae9
@ -5008,11 +5008,10 @@ static int hns_roce_v2_modify_qp(struct ib_qp *ibqp,
|
||||
{
|
||||
struct hns_roce_dev *hr_dev = to_hr_dev(ibqp->device);
|
||||
struct hns_roce_qp *hr_qp = to_hr_qp(ibqp);
|
||||
struct hns_roce_v2_qp_context ctx[2];
|
||||
struct hns_roce_v2_qp_context *context = ctx;
|
||||
struct hns_roce_v2_qp_context *qpc_mask = ctx + 1;
|
||||
struct hns_roce_v2_qp_context *context;
|
||||
struct hns_roce_v2_qp_context *qpc_mask;
|
||||
struct ib_device *ibdev = &hr_dev->ib_dev;
|
||||
int ret;
|
||||
int ret = -ENOMEM;
|
||||
|
||||
if (attr_mask & ~IB_QP_ATTR_STANDARD_BITS)
|
||||
return -EOPNOTSUPP;
|
||||
@ -5023,7 +5022,11 @@ static int hns_roce_v2_modify_qp(struct ib_qp *ibqp,
|
||||
* we should set all bits of the relevant fields in context mask to
|
||||
* 0 at the same time, else set them to 0x1.
|
||||
*/
|
||||
memset(context, 0, hr_dev->caps.qpc_sz);
|
||||
context = kvzalloc(sizeof(*context), GFP_KERNEL);
|
||||
qpc_mask = kvzalloc(sizeof(*qpc_mask), GFP_KERNEL);
|
||||
if (!context || !qpc_mask)
|
||||
goto out;
|
||||
|
||||
memset(qpc_mask, 0xff, hr_dev->caps.qpc_sz);
|
||||
|
||||
ret = hns_roce_v2_set_abs_fields(ibqp, attr, attr_mask, cur_state,
|
||||
@ -5065,6 +5068,8 @@ static int hns_roce_v2_modify_qp(struct ib_qp *ibqp,
|
||||
clear_qp(hr_qp);
|
||||
|
||||
out:
|
||||
kvfree(qpc_mask);
|
||||
kvfree(context);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user