Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

RDMA: Add ib_is_udata_in_empty()

If the driver doesn't yet support any request driver data it should check
that it is all zeroed. This is a common pattern, add a helper around
_ib_copy_validate_udata_in() to do this.

Link: https://patch.msgid.link/r/6-v3-bd56dd443069+49-bnxt_re_uapi_jgg@nvidia.com
Tested-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Acked-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>

+15
+15
include/rdma/uverbs_ioctl.h
··· 1076 1076 }) 1077 1077 1078 1078 /** 1079 + * ib_is_udata_in_empty - Check if the udata input buffer is all zeros 1080 + * @udata: The system calls ib_udata struct 1081 + * 1082 + * This should be used if the driver does not currently define a driver data 1083 + * struct. Returns 0 if the buffer is empty or all zeros, -EOPNOTSUPP if 1084 + * non-zero data is present, or a negative error code on failure. 1085 + */ 1086 + static inline int ib_is_udata_in_empty(struct ib_udata *udata) 1087 + { 1088 + if (!udata || udata->inlen == 0) 1089 + return 0; 1090 + return _ib_copy_validate_udata_in(udata, NULL, 0, 0); 1091 + } 1092 + 1093 + /** 1079 1094 * ib_respond_udata - Copy a driver data response to userspace 1080 1095 * @_udata: The system calls ib_udata struct 1081 1096 * @_rep: Kernel buffer containing the response driver data on the stack