On Thu, Mar 07, 2019 at 06:52:40PM +0200, Leon Romanovsky wrote: > On Wed, Mar 06, 2019 at 03:40:30PM -0400, Jason Gunthorpe wrote: > > On Thu, Feb 28, 2019 at 09:25:50PM +0200, Leon Romanovsky wrote: > > > On Thu, Feb 28, 2019 at 05:57:55PM +0200, Gal Pressman wrote: > > > > On 28-Feb-19 17:38, Bernard Metzler wrote: > > > > >>> + > > > > >>> + rv = ib_copy_to_udata(udata, &uresp, sizeof(uresp)); > > > > >> > > > > >> All ib_copy_from/to_udata should copy the minimum of sizeof() and > > > > >> udata->inlen/outlen. Applies to other places in the code as well. > > > > >> > > > > > Hmmm, shouldn't better the rdma core take care of that? > > > > > > > > Sounds like a good idea, I would love to see such patch :). > > > > Anyway, this should be fixed here or in the core code. > > > > > > If you are talking about drivers/infiniband/core/*, so yes, it was > > > discussed several times, but no one actually sent a patch. > > > > core/* is already done, see uverbs_response(), uverbs_request(), etc > > > > The issue is the drivers were not done similiarly as well, but that is > > the basic format for what the API should look like. > > I lost you here, should ib_copy_to_udata() be updated or > uverbs_response() will handle min() later? uverbs_response shows the correct algorithm - but it works on the core part of the udata not the driver part. We need a driver uverbs_response and so forth following the same pattern. Jason