diff options
author | Jason Gunthorpe <jgg@mellanox.com> | 2018-07-04 08:50:30 +0300 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2018-07-04 13:47:01 -0600 |
commit | 540cd69209682a351ab76b83b85ea856b8192720 (patch) | |
tree | d5f6d2e7b23ec21c5ffde614fc5eb49f7f1e7712 /include/rdma | |
parent | 83bb4442330f035bd68ec5d2f5b87bfef1c1a4ab (diff) | |
download | linux-540cd69209682a351ab76b83b85ea856b8192720.tar.gz linux-540cd69209682a351ab76b83b85ea856b8192720.tar.bz2 linux-540cd69209682a351ab76b83b85ea856b8192720.zip |
RDMA/uverbs: Use UVERBS_ATTR_MIN_SIZE correctly and uniformly
This newer macro allows specifying a lower bound on the accepted size, and
has an 'unlimited' upper bound. Due to this it never checks for trailing
zeroing so it doesn't make any sense to combine it with MIN_SZ_OR_ZERO, so
drop MIN_SZ_OR_ZERO when they are used together
There were a couple of places that open coded this pattern, switch them to
use the clearer UVERBS_ATTR_MIN_SIZE for clarity.
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Diffstat (limited to 'include/rdma')
-rw-r--r-- | include/rdma/uverbs_ioctl.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/include/rdma/uverbs_ioctl.h b/include/rdma/uverbs_ioctl.h index 6073fd9d9c49..0b46ef8f0b4c 100644 --- a/include/rdma/uverbs_ioctl.h +++ b/include/rdma/uverbs_ioctl.h @@ -207,8 +207,11 @@ struct uverbs_object_tree_def { .u.ptr.min_len = ((uintptr_t)(&((_type *)0)->_last + 1)), .u.ptr.len = sizeof(_type) #define UVERBS_ATTR_SIZE(_min_len, _len) \ .u.ptr.min_len = _min_len, .u.ptr.len = _len -#define UVERBS_ATTR_MIN_SIZE(_min_len) \ - UVERBS_ATTR_SIZE(_min_len, USHRT_MAX) +/* + * Specifies at least min_len bytes must be passed in, but the amount can be + * larger, up to the protocol maximum size. No check for zeroing is done. + */ +#define UVERBS_ATTR_MIN_SIZE(_min_len) UVERBS_ATTR_SIZE(_min_len, USHRT_MAX) /* Must be used in the '...' of any UVERBS_ATTR */ #define UA_ALLOC_AND_COPY .alloc_and_copy = 1 @@ -265,13 +268,11 @@ struct uverbs_object_tree_def { */ #define UVERBS_ATTR_UHW() \ UVERBS_ATTR_PTR_IN(UVERBS_ATTR_UHW_IN, \ - UVERBS_ATTR_SIZE(0, USHRT_MAX), \ - UA_OPTIONAL, \ - UA_MIN_SZ_OR_ZERO), \ + UVERBS_ATTR_MIN_SIZE(0), \ + UA_OPTIONAL), \ UVERBS_ATTR_PTR_OUT(UVERBS_ATTR_UHW_OUT, \ - UVERBS_ATTR_SIZE(0, USHRT_MAX), \ - UA_OPTIONAL, \ - UA_MIN_SZ_OR_ZERO), \ + UVERBS_ATTR_MIN_SIZE(0), \ + UA_OPTIONAL) /* * ======================================= |