From: Zheng Yongjun Date: Tue, 29 Dec 2020 13:49:04 +0000 (+0800) Subject: net: tipc: Replace expression with offsetof() X-Git-Tag: v5.15~1802^2~421 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=520ec34385d57ae18ec034ddc38b4b3425b2742b;p=mirror_ubuntu-kernels.git net: tipc: Replace expression with offsetof() Use the existing offsetof() macro instead of duplicating code. Signed-off-by: Zheng Yongjun Signed-off-by: David S. Miller --- diff --git a/net/tipc/monitor.c b/net/tipc/monitor.c index 6dce2abf436e..48fac3b17e40 100644 --- a/net/tipc/monitor.c +++ b/net/tipc/monitor.c @@ -108,7 +108,7 @@ const int tipc_max_domain_size = sizeof(struct tipc_mon_domain); */ static int dom_rec_len(struct tipc_mon_domain *dom, u16 mcnt) { - return ((void *)&dom->members - (void *)dom) + (mcnt * sizeof(u32)); + return (offsetof(struct tipc_mon_domain, members)) + (mcnt * sizeof(u32)); } /* dom_size() : calculate size of own domain based on number of peers