On Thu, May 03, 2018 at 04:36:57PM +0300, Leon Romanovsky wrote: > From: Matan Barak <matanb@xxxxxxxxxxxx> > > When CONFIG_INFINIBAND_USER_ACCESS is disabled, we need to declare > uverbs_idr_class and uverbs_fd_class. This is mandatory, as provider > drivers could use UVERBS_ATTR_FD and UVERBS_ATTR_IDR macros. > Exporting them as all zeros structures to allow compiling provider > drivers without being dependent on ib_uverbs. > > Signed-off-by: Matan Barak <matanb@xxxxxxxxxxxx> > Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx> > --- > drivers/infiniband/core/rdma_core.c | 2 ++ > include/rdma/uverbs_types.h | 5 +++++ > 2 files changed, 7 insertions(+) > > diff --git a/drivers/infiniband/core/rdma_core.c b/drivers/infiniband/core/rdma_core.c > index a6e904973ba8..8035a0a7564c 100644 > --- a/drivers/infiniband/core/rdma_core.c > +++ b/drivers/infiniband/core/rdma_core.c > @@ -611,6 +611,7 @@ const struct uverbs_obj_type_class uverbs_idr_class = { > */ > .needs_kfree_rcu = true, > }; > +EXPORT_SYMBOL(uverbs_idr_class); > > static void _uverbs_close_fd(struct ib_uobject_file *uobj_file) > { > @@ -719,6 +720,7 @@ const struct uverbs_obj_type_class uverbs_fd_class = { > .remove_commit = remove_commit_fd_uobject, > .needs_kfree_rcu = false, > }; > +EXPORT_SYMBOL(uverbs_fd_class); > > struct ib_uobject *uverbs_get_uobject_from_context(const struct uverbs_obj_type *type_attrs, > struct ib_ucontext *ucontext, > diff --git a/include/rdma/uverbs_types.h b/include/rdma/uverbs_types.h > index cc04ec65588d..7c6d1e99c010 100644 > --- a/include/rdma/uverbs_types.h > +++ b/include/rdma/uverbs_types.h > @@ -147,8 +147,13 @@ struct uverbs_obj_fd_type { > int flags; > }; > > +#if IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS) > extern const struct uverbs_obj_type_class uverbs_idr_class; > extern const struct uverbs_obj_type_class uverbs_fd_class; > +#else > +static const struct uverbs_obj_type_class uverbs_idr_class = {}; > +static const struct uverbs_obj_type_class uverbs_fd_class = {}; > +#endif Hurm. This doesn't make much sense, if there is no user access then we shouldn't be building specs at all, or the _class should continue to be defined? I don't want to build specs with pointers to bogus data, that seems like a great way to create runtime bugs. Jason -- 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