Skip to content

Commit 3268330

Browse files
jgunthorperleon
authored andcommitted
RDMA/pvrdma: Use ib_copy_validate_udata_in() for srq
struct pvrdma_create_srq was introduced when the driver was first merged but was never used. At that point it had only buf_addr. Later when SRQ was introduced the struct was expanded. So unlike the other cases that grab the first struct member based on git blame this uses the entire struct. Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
1 parent 54b3bce commit 3268330

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,9 @@ int pvrdma_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
134134
cq->is_kernel = !udata;
135135

136136
if (!cq->is_kernel) {
137-
if (ib_copy_from_udata(&ucmd, udata, sizeof(ucmd))) {
138-
ret = -EFAULT;
137+
ret = ib_copy_validate_udata_in(udata, ucmd, reserved);
138+
if (ret)
139139
goto err_cq;
140-
}
141140

142141
cq->umem = ib_umem_get(ibdev, ucmd.buf_addr, ucmd.buf_size,
143142
IB_ACCESS_LOCAL_WRITE);

0 commit comments

Comments
 (0)