mirror of
https://github.com/torvalds/linux.git
synced 2026-06-04 12:35:52 +02:00
RDMA/mlx5: Use ib_copy_validate_udata_in() for SRQ
flags is the last member for mlx5_ib_create_srq, the uidx is a later extension. Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
This commit is contained in:
parent
3268330fa8
commit
c8f9a7a96e
|
|
@ -48,25 +48,16 @@ static int create_srq_user(struct ib_pd *pd, struct mlx5_ib_srq *srq,
|
|||
struct mlx5_ib_create_srq ucmd = {};
|
||||
struct mlx5_ib_ucontext *ucontext = rdma_udata_to_drv_context(
|
||||
udata, struct mlx5_ib_ucontext, ibucontext);
|
||||
size_t ucmdlen;
|
||||
int err;
|
||||
u32 uidx = MLX5_IB_DEFAULT_UIDX;
|
||||
|
||||
ucmdlen = min(udata->inlen, sizeof(ucmd));
|
||||
|
||||
if (ib_copy_from_udata(&ucmd, udata, ucmdlen)) {
|
||||
mlx5_ib_dbg(dev, "failed copy udata\n");
|
||||
return -EFAULT;
|
||||
}
|
||||
err = ib_copy_validate_udata_in(udata, ucmd, flags);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (ucmd.reserved0 || ucmd.reserved1)
|
||||
return -EINVAL;
|
||||
|
||||
if (udata->inlen > sizeof(ucmd) &&
|
||||
!ib_is_udata_cleared(udata, sizeof(ucmd),
|
||||
udata->inlen - sizeof(ucmd)))
|
||||
return -EINVAL;
|
||||
|
||||
if (in->type != IB_SRQT_BASIC) {
|
||||
err = get_srq_user_index(ucontext, &ucmd, udata->inlen, &uidx);
|
||||
if (err)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user