[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170816220211.25438.24547.stgit@john-Precision-Tower-5810>
Date: Wed, 16 Aug 2017 15:02:12 -0700
From: John Fastabend <john.fastabend@...il.com>
To: daniel@...earbox.net, davem@...emloft.net, eric.dumazet@...il.com,
dsahern@...il.com
Cc: netdev@...r.kernel.org, john.fastabend@...il.com
Subject: [net-next PATCH 1/2] bpf: sockmap state change warning fix
psock will uninitialized in default case we need to do the same psock lookup
and check as in other branch. Fixes compile warning below.
kernel/bpf/sockmap.c: In function ‘smap_state_change’:
kernel/bpf/sockmap.c:156:21: warning: ‘psock’ may be used uninitialized in this function [-Wmaybe-uninitialized]
struct smap_psock *psock;
Fixes: 174a79ff9515 ("bpf: sockmap with sk redirect support")
Reported-by: David Miller <davem@...emloft.net>
Signed-off-by: John Fastabend <john.fastabend@...il.com>
---
kernel/bpf/sockmap.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/bpf/sockmap.c b/kernel/bpf/sockmap.c
index 792f0ad..f7e5e6c 100644
--- a/kernel/bpf/sockmap.c
+++ b/kernel/bpf/sockmap.c
@@ -188,6 +188,9 @@ static void smap_state_change(struct sock *sk)
smap_release_sock(sk);
break;
default:
+ psock = smap_psock_sk(sk);
+ if (unlikely(!psock))
+ break;
smap_report_sk_error(psock, EPIPE);
break;
}
Powered by blists - more mailing lists