Skip to content

Commit

Permalink
net: tipc: Replace expression with offsetof()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Zheng Yongjun authored and davem330 committed Jan 5, 2021
1 parent 2b27748 commit 520ec34
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/tipc/monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 520ec34

Please sign in to comment.