Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: tipc: Replace expression with offsetof()

Use the existing offsetof() macro instead of duplicating code.

Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Zheng Yongjun and committed by
David S. Miller
520ec343 2b27748f

+1 -1
+1 -1
net/tipc/monitor.c
··· 108 108 */ 109 109 static int dom_rec_len(struct tipc_mon_domain *dom, u16 mcnt) 110 110 { 111 - return ((void *)&dom->members - (void *)dom) + (mcnt * sizeof(u32)); 111 + return (offsetof(struct tipc_mon_domain, members)) + (mcnt * sizeof(u32)); 112 112 } 113 113 114 114 /* dom_size() : calculate size of own domain based on number of peers