On Wed, Mar 14, 2018 at 02:39:42PM -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@xxxxxxxxxxxx> > --- > drivers/infiniband/hw/hns/hns_roce_pd.c | 5 ++++- > include/uapi/rdma/hns-abi.h | 5 +++++ > 2 files changed, 9 insertions(+), 1 deletion(-) > > hns team: This patch goes along with the remarks in my prior email, > structs should always be used with hns_roce_ib_alloc_pd_resp. Please > ensure whatever you come up with follows that principle. > > Thanks, > Jason > > diff --git a/drivers/infiniband/hw/hns/hns_roce_pd.c b/drivers/infiniband/hw/hns/hns_roce_pd.c > index bdab2188c04a9a..4b41e041799cae 100644 > --- a/drivers/infiniband/hw/hns/hns_roce_pd.c > +++ b/drivers/infiniband/hw/hns/hns_roce_pd.c > @@ -32,6 +32,7 @@ > > #include <linux/platform_device.h> > #include <linux/pci.h> > +#include <uapi/rdma/hns-abi.h> > #include "hns_roce_device.h" > > static int hns_roce_pd_alloc(struct hns_roce_dev *hr_dev, unsigned long *pdn) > @@ -77,7 +78,9 @@ struct ib_pd *hns_roce_alloc_pd(struct ib_device *ib_dev, > } > > if (context) { > - if (ib_copy_to_udata(udata, &pd->pdn, sizeof(u64))) { > + struct hns_roce_ib_alloc_pd_resp uresp = {.pdn = pd->pdn}; > + > + if (ib_copy_to_udata(udata, &uresp, sizeof(uresp))) { > hns_roce_pd_free(to_hr_dev(ib_dev), pd->pdn); > dev_err(dev, "[alloc_pd]ib_copy_to_udata failed!\n"); > kfree(pd); > diff --git a/include/uapi/rdma/hns-abi.h b/include/uapi/rdma/hns-abi.h > index 4df5b79c9e11a3..a464d7945ebb48 100644 > --- a/include/uapi/rdma/hns-abi.h > +++ b/include/uapi/rdma/hns-abi.h > @@ -64,4 +64,9 @@ struct hns_roce_ib_alloc_ucontext_resp { > __u32 qp_tab_size; > __u32 reserved; > }; > + > +struct hns_roce_ib_alloc_pd_resp { > + __u32 pdn; > +}; Don't we want to pad this struct to 64bits? Thanks > + > #endif /* HNS_ABI_USER_H */ > -- > 2.16.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in > the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html
Attachment:
signature.asc
Description: PGP signature