diff mbox series

RDMA/core: Use offsetofend() instead of open coding

Message ID 0-v1-0bc346e08476+585-drop_offsetofend_jgg@mellanox.com (mailing list archive)
State Mainlined
Commit ffd7339a2fac98b9ff731e336c4411bf1ce57e22
Delegated to: Jason Gunthorpe
Headers show
Series RDMA/core: Use offsetofend() instead of open coding | expand

Commit Message

Jason Gunthorpe May 27, 2020, 5:18 p.m. UTC
From: Jason Gunthorpe <jgg@mellanox.com>

No reason to open code this.

Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
---
 include/rdma/uverbs_ioctl.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Jason Gunthorpe May 29, 2020, 6:29 p.m. UTC | #1
On Wed, May 27, 2020 at 02:18:45PM -0300, Jason Gunthorpe wrote:
> From: Jason Gunthorpe <jgg@mellanox.com>
> 
> No reason to open code this.
> 
> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
> ---
>  include/rdma/uverbs_ioctl.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Applied to for-next, thanks

Jason
diff mbox series

Patch

diff --git a/include/rdma/uverbs_ioctl.h b/include/rdma/uverbs_ioctl.h
index 0418d7bddf3e0c..86de10ea30afb1 100644
--- a/include/rdma/uverbs_ioctl.h
+++ b/include/rdma/uverbs_ioctl.h
@@ -491,8 +491,7 @@  struct uapi_definition {
  */
 #define UVERBS_ATTR_STRUCT(_type, _last)                                       \
 	.zero_trailing = 1,                                                    \
-	UVERBS_ATTR_SIZE(((uintptr_t)(&((_type *)0)->_last + 1)),              \
-			 sizeof(_type))
+	UVERBS_ATTR_SIZE(offsetofend(_type, _last), sizeof(_type))
 /*
  * 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.