On 08/16/2017 11:35 AM, David Miller wrote:
> From: David Miller <da...@davemloft.net>
> Date: Wed, 16 Aug 2017 11:28:19 -0700 (PDT)
> 
>> From: John Fastabend <john.fastab...@gmail.com>
>> Date: Tue, 15 Aug 2017 22:30:15 -0700
>>
>>> This series implements a sockmap and socket redirect helper for BPF
>>> using a model similar to XDP netdev redirect.
>>
>> Series applied, thanks John.
>>
> 
> We get a legit warning from gcc due to these changes:
> 
> 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;
> 
> It's the default switch case in this function, psock is not initialized
> for sure at this point.
> 

I missed this with older gcc4 it seems. Fixed now and compiling without errors
now with gcc4/5. Below is the diff and all verifier/sockmap tests pass. Want a
v2 I presume?

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;
        }

Reply via email to