]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
net: tipc: Replace expression with offsetof()
authorZheng Yongjun <zhengyongjun3@huawei.com>
Tue, 29 Dec 2020 13:49:04 +0000 (21:49 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 5 Jan 2021 23:43:41 +0000 (15:43 -0800)
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>
net/tipc/monitor.c

index 6dce2abf436eeddd4983e1fe09417338af87a97f..48fac3b17e404d1b15b998f6a033127ee6daaedf 100644 (file)
@@ -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