diff options
author | Anders Roxell <anders.roxell@linaro.org> | 2018-09-07 08:50:05 -0400 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2018-09-11 17:54:52 -0400 |
commit | 1edb6e035eb72a17462ba275fe2db36c37a62909 (patch) | |
tree | 3f33396f58fc85d214b210d4700b5a125c002ac7 | |
parent | 9d0b3c1f1451d1b9a33de3c70ae3d50ccd77db1a (diff) |
net/core/filter: fix unused-variable warning
Building with CONFIG_INET=n will show the warning below:
net/core/filter.c: In function ‘____bpf_getsockopt’:
net/core/filter.c:4048:19: warning: unused variable ‘tp’ [-Wunused-variable]
struct tcp_sock *tp;
^~
net/core/filter.c:4046:31: warning: unused variable ‘icsk’ [-Wunused-variable]
struct inet_connection_sock *icsk;
^~~~
Move the variable declarations inside the {} block where they are used.
Fixes: 1e215300f138 ("bpf: add TCP_SAVE_SYN/TCP_SAVED_SYN options for bpf_(set|get)sockopt")
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
-rw-r--r-- | net/core/filter.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/core/filter.c b/net/core/filter.c index 8cb242b4400f..bf5b6efd369a 100644 --- a/net/core/filter.c +++ b/net/core/filter.c | |||
@@ -4051,14 +4051,15 @@ static const struct bpf_func_proto bpf_setsockopt_proto = { | |||
4051 | BPF_CALL_5(bpf_getsockopt, struct bpf_sock_ops_kern *, bpf_sock, | 4051 | BPF_CALL_5(bpf_getsockopt, struct bpf_sock_ops_kern *, bpf_sock, |
4052 | int, level, int, optname, char *, optval, int, optlen) | 4052 | int, level, int, optname, char *, optval, int, optlen) |
4053 | { | 4053 | { |
4054 | struct inet_connection_sock *icsk; | ||
4055 | struct sock *sk = bpf_sock->sk; | 4054 | struct sock *sk = bpf_sock->sk; |
4056 | struct tcp_sock *tp; | ||
4057 | 4055 | ||
4058 | if (!sk_fullsock(sk)) | 4056 | if (!sk_fullsock(sk)) |
4059 | goto err_clear; | 4057 | goto err_clear; |
4060 | #ifdef CONFIG_INET | 4058 | #ifdef CONFIG_INET |
4061 | if (level == SOL_TCP && sk->sk_prot->getsockopt == tcp_getsockopt) { | 4059 | if (level == SOL_TCP && sk->sk_prot->getsockopt == tcp_getsockopt) { |
4060 | struct inet_connection_sock *icsk; | ||
4061 | struct tcp_sock *tp; | ||
4062 | |||
4062 | switch (optname) { | 4063 | switch (optname) { |
4063 | case TCP_CONGESTION: | 4064 | case TCP_CONGESTION: |
4064 | icsk = inet_csk(sk); | 4065 | icsk = inet_csk(sk); |