Commit 614d79c0 authored by stephen hemminger's avatar stephen hemminger Committed by David S. Miller

socket: fix set not used warning

The variable owned_by_user is always set, but only used
when kernel is configured with LOCKDEP enabled.

Get rid of the warning by moving the code to put the call
to owned_by_user into the the rcu_protected call.
Signed-off-by: default avatarStephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3754b87a
...@@ -3404,7 +3404,6 @@ u32 kernel_sock_ip_overhead(struct sock *sk) ...@@ -3404,7 +3404,6 @@ u32 kernel_sock_ip_overhead(struct sock *sk)
struct inet_sock *inet; struct inet_sock *inet;
struct ip_options_rcu *opt; struct ip_options_rcu *opt;
u32 overhead = 0; u32 overhead = 0;
bool owned_by_user;
#if IS_ENABLED(CONFIG_IPV6) #if IS_ENABLED(CONFIG_IPV6)
struct ipv6_pinfo *np; struct ipv6_pinfo *np;
struct ipv6_txoptions *optv6 = NULL; struct ipv6_txoptions *optv6 = NULL;
...@@ -3413,13 +3412,12 @@ u32 kernel_sock_ip_overhead(struct sock *sk) ...@@ -3413,13 +3412,12 @@ u32 kernel_sock_ip_overhead(struct sock *sk)
if (!sk) if (!sk)
return overhead; return overhead;
owned_by_user = sock_owned_by_user(sk);
switch (sk->sk_family) { switch (sk->sk_family) {
case AF_INET: case AF_INET:
inet = inet_sk(sk); inet = inet_sk(sk);
overhead += sizeof(struct iphdr); overhead += sizeof(struct iphdr);
opt = rcu_dereference_protected(inet->inet_opt, opt = rcu_dereference_protected(inet->inet_opt,
owned_by_user); sock_owned_by_user(sk));
if (opt) if (opt)
overhead += opt->opt.optlen; overhead += opt->opt.optlen;
return overhead; return overhead;
...@@ -3429,7 +3427,7 @@ u32 kernel_sock_ip_overhead(struct sock *sk) ...@@ -3429,7 +3427,7 @@ u32 kernel_sock_ip_overhead(struct sock *sk)
overhead += sizeof(struct ipv6hdr); overhead += sizeof(struct ipv6hdr);
if (np) if (np)
optv6 = rcu_dereference_protected(np->opt, optv6 = rcu_dereference_protected(np->opt,
owned_by_user); sock_owned_by_user(sk));
if (optv6) if (optv6)
overhead += (optv6->opt_flen + optv6->opt_nflen); overhead += (optv6->opt_flen + optv6->opt_nflen);
return overhead; return overhead;
......
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