Skip to content

Commit 1edb6e0

Browse files
roxellAlexei Starovoitov
authored and
Alexei Starovoitov
committed
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: 1e21530 ("bpf: add TCP_SAVE_SYN/TCP_SAVED_SYN options for bpf_(set|get)sockopt") Signed-off-by: Anders Roxell <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 9d0b3c1 commit 1edb6e0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

net/core/filter.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4051,14 +4051,15 @@ static const struct bpf_func_proto bpf_setsockopt_proto = {
40514051
BPF_CALL_5(bpf_getsockopt, struct bpf_sock_ops_kern *, bpf_sock,
40524052
int, level, int, optname, char *, optval, int, optlen)
40534053
{
4054-
struct inet_connection_sock *icsk;
40554054
struct sock *sk = bpf_sock->sk;
4056-
struct tcp_sock *tp;
40574055

40584056
if (!sk_fullsock(sk))
40594057
goto err_clear;
40604058
#ifdef CONFIG_INET
40614059
if (level == SOL_TCP && sk->sk_prot->getsockopt == tcp_getsockopt) {
4060+
struct inet_connection_sock *icsk;
4061+
struct tcp_sock *tp;
4062+
40624063
switch (optname) {
40634064
case TCP_CONGESTION:
40644065
icsk = inet_csk(sk);

0 commit comments

Comments
 (0)