On Mon, Jan 28, 2019 at 12:01:06PM -0700, Jason Gunthorpe wrote: > * If udata is not NULL this cannot fail. Otherwise a NULL udata will result > * in a NULL ucontext pointer. Callers can rely on !NULL ucontext to show the > * op is being called as part of a user system call. > */ > #define rdma_udata_to_drv_context(udata, drv_dev_struct, member) \ > (udata ? container_of(container_of(udata, struct uverbs_attr_bundle, \ > driver_udata) \ > ->context, \ > drv_dev_struct, member) : \ > (drv_dev_struct *)NULL) > > And get rid of the rdma_get_ucontext helper function, umem can just > inspect udata->context itself and fail with EIO if NULL. And what exactly is the benefit over opencoding it? Yes, it'll save about 2 lines of source per caller, but it will also make the code basically unreadable without looking at the defintion of rdma_udata_to_drv_context.