Commit 520ec343 authored by Zheng Yongjun's avatar Zheng Yongjun Committed by David S. Miller

net: tipc: Replace expression with offsetof()

Use the existing offsetof() macro instead of duplicating code.
Signed-off-by: default avatarZheng Yongjun <zhengyongjun3@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2b27748f
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment