diff options
author | Jason Gunthorpe <jgg@mellanox.com> | 2018-11-25 21:58:34 +0300 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2018-12-03 19:57:41 +0300 |
commit | bbb28ad9035f8efa9c5581b3809ff8055cc1f4b2 (patch) | |
tree | 025f06849aee4e59e9e65a3aa3cf538675d13df8 /drivers/infiniband | |
parent | 34f4c9554d8b2a7d2deb9503e9373b598ee3279f (diff) | |
download | linux-bbb28ad9035f8efa9c5581b3809ff8055cc1f4b2.tar.xz |
RDMA/uverbs: Remove out_len checks that are now done by the core
write() methods must work with fixed sized structures as that is the only
way to know where the udata segment starts. The common udata code now
rejects any write() that has a response buffer shorter than the core's
response.
Thus all the checks of out_len for write methods are redundant and can be
removed.
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/core/uverbs_cmd.c | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c index dc06b6914b5e..5708abc0e4d4 100644 --- a/drivers/infiniband/core/uverbs_cmd.c +++ b/drivers/infiniband/core/uverbs_cmd.c @@ -78,9 +78,6 @@ static int ib_uverbs_get_context(struct uverbs_attr_bundle *attrs, struct ib_device *ib_dev; int ret; - if (out_len < sizeof resp) - return -ENOSPC; - if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; @@ -231,9 +228,6 @@ static int ib_uverbs_query_device(struct uverbs_attr_bundle *attrs, if (IS_ERR(ucontext)) return PTR_ERR(ucontext); - if (out_len < sizeof resp) - return -ENOSPC; - if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; @@ -282,9 +276,6 @@ static int ib_uverbs_query_port(struct uverbs_attr_bundle *attrs, return PTR_ERR(ucontext); ib_dev = ucontext->device; - if (out_len < sizeof resp) - return -ENOSPC; - if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; @@ -341,9 +332,6 @@ static int ib_uverbs_alloc_pd(struct uverbs_attr_bundle *attrs, int ret; struct ib_device *ib_dev; - if (out_len < sizeof resp) - return -ENOSPC; - if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; @@ -493,9 +481,6 @@ static int ib_uverbs_open_xrcd(struct uverbs_attr_bundle *attrs, int new_xrcd = 0; struct ib_device *ib_dev; - if (out_len < sizeof resp) - return -ENOSPC; - if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; @@ -642,9 +627,6 @@ static int ib_uverbs_reg_mr(struct uverbs_attr_bundle *attrs, int ret; struct ib_device *ib_dev; - if (out_len < sizeof resp) - return -ENOSPC; - if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; @@ -727,9 +709,6 @@ static int ib_uverbs_rereg_mr(struct uverbs_attr_bundle *attrs, int ret; struct ib_uobject *uobj; - if (out_len < sizeof(resp)) - return -ENOSPC; - if (copy_from_user(&cmd, buf, sizeof(cmd))) return -EFAULT; @@ -822,9 +801,6 @@ static int ib_uverbs_alloc_mw(struct uverbs_attr_bundle *attrs, int ret; struct ib_device *ib_dev; - if (out_len < sizeof(resp)) - return -ENOSPC; - if (copy_from_user(&cmd, buf, sizeof(cmd))) return -EFAULT; @@ -893,9 +869,6 @@ static int ib_uverbs_create_comp_channel(struct uverbs_attr_bundle *attrs, struct ib_uverbs_completion_event_file *ev_file; struct ib_device *ib_dev; - if (out_len < sizeof resp) - return -ENOSPC; - if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; @@ -1031,9 +1004,6 @@ static int ib_uverbs_create_cq(struct uverbs_attr_bundle *attrs, struct ib_udata ucore; struct ib_ucq_object *obj; - if (out_len < sizeof(resp)) - return -ENOSPC; - if (copy_from_user(&cmd, buf, sizeof(cmd))) return -EFAULT; @@ -1549,9 +1519,6 @@ static int ib_uverbs_create_qp(struct uverbs_attr_bundle *attrs, ssize_t resp_size = sizeof(struct ib_uverbs_create_qp_resp); int err; - if (out_len < resp_size) - return -ENOSPC; - if (copy_from_user(&cmd, buf, sizeof(cmd))) return -EFAULT; @@ -1641,9 +1608,6 @@ static int ib_uverbs_open_qp(struct uverbs_attr_bundle *attrs, int ret; struct ib_device *ib_dev; - if (out_len < sizeof resp) - return -ENOSPC; - if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; @@ -2476,9 +2440,6 @@ static int ib_uverbs_create_ah(struct uverbs_attr_bundle *attrs, int ret; struct ib_device *ib_dev; - if (out_len < sizeof resp) - return -ENOSPC; - if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; @@ -3667,10 +3628,6 @@ static int ib_uverbs_create_srq(struct uverbs_attr_bundle *attrs, { struct ib_uverbs_create_srq cmd; struct ib_uverbs_create_xsrq xcmd; - struct ib_uverbs_create_srq_resp resp; - - if (out_len < sizeof resp) - return -ENOSPC; if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; @@ -3692,10 +3649,6 @@ static int ib_uverbs_create_xsrq(struct uverbs_attr_bundle *attrs, int out_len) { struct ib_uverbs_create_xsrq cmd; - struct ib_uverbs_create_srq_resp resp; - - if (out_len < sizeof resp) - return -ENOSPC; if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; @@ -3738,9 +3691,6 @@ static int ib_uverbs_query_srq(struct uverbs_attr_bundle *attrs, struct ib_srq *srq; int ret; - if (out_len < sizeof resp) - return -ENOSPC; - if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; |