Re: [PATCH] RDMA/core: Remove _ib_copy_validate_udata_in() and _ib_respond_udata() stubs

From: Jason Gunthorpe

Date: Tue May 19 2026 - 18:49:19 EST


On Tue, May 19, 2026 at 11:24:36AM -0700, Nathan Chancellor wrote:
> After commit 65b044cee9fb ("RDMA/core: Move the _ib_copy_validate_udata*
> functions to ib_core_uverbs"), builds without INFINIBAND_USER_ACCESS
> enabled fail with:
>
> drivers/infiniband/core/ib_core_uverbs.c:433:5: error: redefinition of '_ib_copy_validate_udata_in'
> 433 | int _ib_copy_validate_udata_in(struct ib_udata *udata, void *req,
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~
> In file included from include/rdma/uverbs_std_types.h:10,
> from drivers/infiniband/core/uverbs.h:49,
> from drivers/infiniband/core/ib_core_uverbs.c:10:
> include/rdma/uverbs_ioctl.h:961:19: note: previous definition of '_ib_copy_validate_udata_in' with type 'int(struct ib_udata *, void *, size_t, size_t)' {aka 'int(struct ib_udata *, void *, long unsigned int, long unsigned int)'}
> 961 | static inline int _ib_copy_validate_udata_in(struct ib_udata *udata, void *req,
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/infiniband/core/ib_core_uverbs.c:483:5: error: redefinition of '_ib_respond_udata'
> 483 | int _ib_respond_udata(struct ib_udata *udata, const void *src, size_t len)
> | ^~~~~~~~~~~~~~~~~
> include/rdma/uverbs_ioctl.h:968:19: note: previous definition of '_ib_respond_udata' with type 'int(struct ib_udata *, const void *, size_t)' {aka 'int(struct ib_udata *, const void *, long unsigned int)'}
> 968 | static inline int _ib_respond_udata(struct ib_udata *udata, const void *src,
> | ^~~~~~~~~~~~~~~~~
>
> Remove the stubs and adjust the prototypes for _ib_respond_udata() and
> _ib_copy_validate_udata_in(), as they will always be available when
> INFINIBAND is enabled.

Ugh, we should get rid of this option these days..

The right thing is to #ifdef away the moved C code since it doesn't
get removed by the makefile and keep the static inlines.

Possibly even all of drivers/infiniband/core/ib_core_uverbs.c should
be put under a conditional, I'll look at that later

--- a/drivers/infiniband/core/ib_core_uverbs.c
+++ b/drivers/infiniband/core/ib_core_uverbs.c
@@ -417,6 +417,7 @@ struct ib_device *rdma_udata_to_dev(struct ib_udata *udata)
}
EXPORT_SYMBOL(rdma_udata_to_dev);

+#if IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS)
uverbs_api_ioctl_handler_fn uverbs_get_handler_fn(struct ib_udata *udata)
{
struct uverbs_attr_bundle *bundle =
@@ -501,3 +502,4 @@ int _ib_respond_udata(struct ib_udata *udata, const void *src, size_t len)
return -EFAULT;
}
EXPORT_SYMBOL(_ib_respond_udata);
+#endif

I guess I'll squash it in, unlucky that 0-day didn't notice this, or
maybe it isn't working anymore...

Thanks,
Jason