Commit cf56e3b9 authored by John Fastabend's avatar John Fastabend Committed by David S. Miller

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: 174a79ff ("bpf: sockmap with sk redirect support")
Reported-by: default avatarDavid Miller <davem@davemloft.net>
Signed-off-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d978db8d
...@@ -188,6 +188,9 @@ static void smap_state_change(struct sock *sk) ...@@ -188,6 +188,9 @@ static void smap_state_change(struct sock *sk)
smap_release_sock(sk); smap_release_sock(sk);
break; break;
default: default:
psock = smap_psock_sk(sk);
if (unlikely(!psock))
break;
smap_report_sk_error(psock, EPIPE); smap_report_sk_error(psock, EPIPE);
break; break;
} }
......
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