]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
RDMA/pvrdma: Use ib_copy_validate_udata_in() for srq
authorJason Gunthorpe <jgg@nvidia.com>
Wed, 25 Mar 2026 21:26:51 +0000 (18:26 -0300)
committerLeon Romanovsky <leonro@nvidia.com>
Tue, 31 Mar 2026 07:11:01 +0000 (03:11 -0400)
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>
drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c

index b3df6eb9b8eff64fba34f007c3af8a6d67ac006a..bc3adcc1ae67c293be7917fc7fab0882057f2a9a 100644 (file)
@@ -134,10 +134,9 @@ int pvrdma_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
        cq->is_kernel = !udata;
 
        if (!cq->is_kernel) {
-               if (ib_copy_from_udata(&ucmd, udata, sizeof(ucmd))) {
-                       ret = -EFAULT;
+               ret = ib_copy_validate_udata_in(udata, ucmd, reserved);
+               if (ret)
                        goto err_cq;
-               }
 
                cq->umem = ib_umem_get(ibdev, ucmd.buf_addr, ucmd.buf_size,
                                       IB_ACCESS_LOCAL_WRITE);