Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

RDMA/mlx5: Pull comp_mask validation into ib_copy_validate_udata_in_cm()

Directly check the supported comp_mask bitmap using
ib_copy_validate_udata_in_cm() and remove the open coding.

Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>

authored by

Jason Gunthorpe and committed by
Leon Romanovsky
676b5707 604caebc

+8 -9
+8 -9
drivers/infiniband/hw/mlx5/qp.c
··· 4707 4707 return -ENOSYS; 4708 4708 4709 4709 if (udata && udata->inlen) { 4710 - err = ib_copy_validate_udata_in(udata, ucmd, ece_options); 4710 + err = ib_copy_validate_udata_in_cm(udata, ucmd, ece_options, 4711 + MLX5_IB_MODIFY_QP_OOO_DP); 4711 4712 if (err) 4712 4713 return err; 4713 4714 4714 - if (ucmd.comp_mask & ~MLX5_IB_MODIFY_QP_OOO_DP || 4715 - memchr_inv(&ucmd.burst_info.reserved, 0, 4715 + if (memchr_inv(&ucmd.burst_info.reserved, 0, 4716 4716 sizeof(ucmd.burst_info.reserved))) 4717 4717 return -EOPNOTSUPP; 4718 4718 ··· 5381 5381 struct mlx5_ib_dev *dev = to_mdev(pd->device); 5382 5382 struct mlx5_ib_create_wq ucmd = {}; 5383 5383 int err; 5384 - err = ib_copy_validate_udata_in(udata, ucmd, 5385 - single_stride_log_num_of_bytes); 5384 + 5385 + err = ib_copy_validate_udata_in_cm(udata, ucmd, 5386 + single_stride_log_num_of_bytes, 5387 + MLX5_IB_CREATE_WQ_STRIDING_RQ); 5386 5388 if (err) { 5387 5389 mlx5_ib_dbg(dev, "copy failed\n"); 5388 5390 return err; 5389 5391 } 5390 5392 5391 - if (ucmd.comp_mask & (~MLX5_IB_CREATE_WQ_STRIDING_RQ)) { 5392 - mlx5_ib_dbg(dev, "invalid comp mask\n"); 5393 - return -EOPNOTSUPP; 5394 - } else if (ucmd.comp_mask & MLX5_IB_CREATE_WQ_STRIDING_RQ) { 5393 + if (ucmd.comp_mask & MLX5_IB_CREATE_WQ_STRIDING_RQ) { 5395 5394 if (!MLX5_CAP_GEN(dev->mdev, striding_rq)) { 5396 5395 mlx5_ib_dbg(dev, "Striding RQ is not supported\n"); 5397 5396 return -EOPNOTSUPP;