Message ID | 20180314220150.GA15197@ziepe.ca (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Jason Gunthorpe |
Headers | show |
> > Open coding a loose value size is not acceptable for describing > the uABI in RDMA. Provide the missing struct. > > Signed-off-by: Jason Gunthorpe <jgg@mellanox.com> > --- > drivers/infiniband/hw/cxgb4/provider.c | 4 +++- > include/uapi/rdma/cxgb4-abi.h | 5 +++++ > 2 files changed, 8 insertions(+), 1 deletion(-) > > diff --git a/drivers/infiniband/hw/cxgb4/provider.c > b/drivers/infiniband/hw/cxgb4/provider.c > index 1b5c6cd2ac4d5f..42568a4df3f83f 100644 > --- a/drivers/infiniband/hw/cxgb4/provider.c > +++ b/drivers/infiniband/hw/cxgb4/provider.c > @@ -281,7 +281,9 @@ static struct ib_pd *c4iw_allocate_pd(struct ib_device > *ibdev, > php->pdid = pdid; > php->rhp = rhp; > if (context) { > - if (ib_copy_to_udata(udata, &php->pdid, sizeof(u32))) { > + struct c4iw_alloc_pd_resp uresp = {.pdid = php->pdid}; > + > + if (ib_copy_to_udata(udata, &uresp, sizeof(uresp))) { > c4iw_deallocate_pd(&php->ibpd); > return ERR_PTR(-EFAULT); > } > diff --git a/include/uapi/rdma/cxgb4-abi.h b/include/uapi/rdma/cxgb4-abi.h > index 004e92b8366ef7..1fefd0140c26f6 100644 > --- a/include/uapi/rdma/cxgb4-abi.h > +++ b/include/uapi/rdma/cxgb4-abi.h > @@ -79,4 +79,9 @@ struct c4iw_alloc_ucontext_resp { > __u32 status_page_size; > __u32 reserved; /* explicit padding (optional for i386) */ > }; > + > +struct c4iw_alloc_pd_resp { > + __u32 pdid; > +}; > + > #endif /* CXGB4_ABI_USER_H */ > -- Does it need a u32 pad for 64b alignment? Reviewed-by: Steve Wise <swise@opengridcomputing.com> -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, Mar 14, 2018 at 04:01:50PM -0600, Jason Gunthorpe wrote: > Open coding a loose value size is not acceptable for describing > the uABI in RDMA. Provide the missing struct. > > Signed-off-by: Jason Gunthorpe <jgg@mellanox.com> > Reviewed-by: Steve Wise <swise@opengridcomputing.com> > drivers/infiniband/hw/cxgb4/provider.c | 4 +++- > include/uapi/rdma/cxgb4-abi.h | 5 +++++ > 2 files changed, 8 insertions(+), 1 deletion(-) Applied to for-next Jason -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/infiniband/hw/cxgb4/provider.c b/drivers/infiniband/hw/cxgb4/provider.c index 1b5c6cd2ac4d5f..42568a4df3f83f 100644 --- a/drivers/infiniband/hw/cxgb4/provider.c +++ b/drivers/infiniband/hw/cxgb4/provider.c @@ -281,7 +281,9 @@ static struct ib_pd *c4iw_allocate_pd(struct ib_device *ibdev, php->pdid = pdid; php->rhp = rhp; if (context) { - if (ib_copy_to_udata(udata, &php->pdid, sizeof(u32))) { + struct c4iw_alloc_pd_resp uresp = {.pdid = php->pdid}; + + if (ib_copy_to_udata(udata, &uresp, sizeof(uresp))) { c4iw_deallocate_pd(&php->ibpd); return ERR_PTR(-EFAULT); } diff --git a/include/uapi/rdma/cxgb4-abi.h b/include/uapi/rdma/cxgb4-abi.h index 004e92b8366ef7..1fefd0140c26f6 100644 --- a/include/uapi/rdma/cxgb4-abi.h +++ b/include/uapi/rdma/cxgb4-abi.h @@ -79,4 +79,9 @@ struct c4iw_alloc_ucontext_resp { __u32 status_page_size; __u32 reserved; /* explicit padding (optional for i386) */ }; + +struct c4iw_alloc_pd_resp { + __u32 pdid; +}; + #endif /* CXGB4_ABI_USER_H */
Open coding a loose value size is not acceptable for describing the uABI in RDMA. Provide the missing struct. Signed-off-by: Jason Gunthorpe <jgg@mellanox.com> --- drivers/infiniband/hw/cxgb4/provider.c | 4 +++- include/uapi/rdma/cxgb4-abi.h | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-)