]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
RDMA/efa: Remove redundant udata check from alloc ucontext response
authorGal Pressman <galpress@amazon.com>
Tue, 18 Aug 2020 11:08:35 +0000 (14:08 +0300)
committerJason Gunthorpe <jgg@nvidia.com>
Mon, 24 Aug 2020 17:45:54 +0000 (14:45 -0300)
The alloc ucontext flow is always called with a valid udata, there's no
need to test whether it's NULL.

While at it, the 'udata->outlen' check is removed as well as we copy the
minimum between the size of the response and outlen, so in case of zero
outlen, zero bytes will be copied.

Link: https://lore.kernel.org/r/20200818110835.54299-1-galpress@amazon.com
Reviewed-by: Firas JahJah <firasj@amazon.com>
Reviewed-by: Yossi Leybovich <sleybo@amazon.com>
Signed-off-by: Gal Pressman <galpress@amazon.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/efa/efa_verbs.c

index 3f7f19b9f463fefcda5aabaafd268ecf94b5330f..de9a22f0fcc218f054f0f6fd8c591a0dbd923538 100644 (file)
@@ -1698,12 +1698,10 @@ int efa_alloc_ucontext(struct ib_ucontext *ibucontext, struct ib_udata *udata)
        resp.max_tx_batch = dev->dev_attr.max_tx_batch;
        resp.min_sq_wr = dev->dev_attr.min_sq_depth;
 
-       if (udata && udata->outlen) {
-               err = ib_copy_to_udata(udata, &resp,
-                                      min(sizeof(resp), udata->outlen));
-               if (err)
-                       goto err_dealloc_uar;
-       }
+       err = ib_copy_to_udata(udata, &resp,
+                              min(sizeof(resp), udata->outlen));
+       if (err)
+               goto err_dealloc_uar;
 
        return 0;