From: Jason Gunthorpe <jgg@mellanox.com>
Date: Wed, 27 May 2020 14:18:45 -0300
Subject: RDMA/core: Use offsetofend() instead of open coding
Patch-mainline: v5.8-rc1
Git-commit: ffd7339a2fac98b9ff731e336c4411bf1ce57e22
References: jsc#SLE-15176
No reason to open code this.
Link: https://lore.kernel.org/r/0-v1-0bc346e08476+585-drop_offsetofend_jgg@mellanox.com
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
include/rdma/uverbs_ioctl.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
--- 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.