diff options
author | Kuniyuki Iwashima <kuniyu@amazon.com> | 2022-06-21 19:19:08 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-06-22 13:59:43 +0200 |
commit | 340c3d337119ea177a98338be2e3bc62ee87ac80 (patch) | |
tree | 6fb613affc4be36634c393ad26c7de92dd051e3e /net/unix/diag.c | |
parent | Merge branch 'mlxsw-unified-bridge-conversion-part-2' (diff) | |
download | linux-340c3d337119ea177a98338be2e3bc62ee87ac80.tar.xz linux-340c3d337119ea177a98338be2e3bc62ee87ac80.zip |
af_unix: Clean up some sock_net() uses.
Some functions define a net pointer only for one-shot use. Others call
sock_net() redundantly even when a net pointer is available. Let's fix
these and make the code simpler.
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/unix/diag.c')
-rw-r--r-- | net/unix/diag.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/net/unix/diag.c b/net/unix/diag.c index bb0b5ea1655f..4e3dc8179fa4 100644 --- a/net/unix/diag.c +++ b/net/unix/diag.c @@ -308,7 +308,6 @@ out_nosk: static int unix_diag_handler_dump(struct sk_buff *skb, struct nlmsghdr *h) { int hdrlen = sizeof(struct unix_diag_req); - struct net *net = sock_net(skb->sk); if (nlmsg_len(h) < hdrlen) return -EINVAL; @@ -317,7 +316,7 @@ static int unix_diag_handler_dump(struct sk_buff *skb, struct nlmsghdr *h) struct netlink_dump_control c = { .dump = unix_diag_dump, }; - return netlink_dump_start(net->diag_nlsk, skb, h, &c); + return netlink_dump_start(sock_net(skb->sk)->diag_nlsk, skb, h, &c); } else return unix_diag_get_exact(skb, h, nlmsg_data(h)); } |