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: 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>

authored by

Jason Gunthorpe and committed by
Leon Romanovsky
c8f9a7a9 3268330f

+3 -12
+3 -12
drivers/infiniband/hw/mlx5/srq.c
··· 48 48 struct mlx5_ib_create_srq ucmd = {}; 49 49 struct mlx5_ib_ucontext *ucontext = rdma_udata_to_drv_context( 50 50 udata, struct mlx5_ib_ucontext, ibucontext); 51 - size_t ucmdlen; 52 51 int err; 53 52 u32 uidx = MLX5_IB_DEFAULT_UIDX; 54 53 55 - ucmdlen = min(udata->inlen, sizeof(ucmd)); 56 - 57 - if (ib_copy_from_udata(&ucmd, udata, ucmdlen)) { 58 - mlx5_ib_dbg(dev, "failed copy udata\n"); 59 - return -EFAULT; 60 - } 54 + err = ib_copy_validate_udata_in(udata, ucmd, flags); 55 + if (err) 56 + return err; 61 57 62 58 if (ucmd.reserved0 || ucmd.reserved1) 63 - return -EINVAL; 64 - 65 - if (udata->inlen > sizeof(ucmd) && 66 - !ib_is_udata_cleared(udata, sizeof(ucmd), 67 - udata->inlen - sizeof(ucmd))) 68 59 return -EINVAL; 69 60 70 61 if (in->type != IB_SRQT_BASIC) {