Martin Lau wrote: > On Mon, Oct 14, 2019 at 03:13:30PM +0300, Dan Carpenter wrote: > > Hello Daniel Borkmann, > > > > This is a semi-automatic email about new static checker warnings. > > > > The patch 604326b41a6f: "bpf, sockmap: convert to generic sk_msg > > interface" from Oct 13, 2018, leads to the following Smatch complaint: > > > > net/core/skmsg.c:792 sk_psock_write_space() > > error: we previously assumed 'psock' could be null (see line 790) > > > > net/core/skmsg.c > > 789 psock = sk_psock(sk); > > 790 if (likely(psock && sk_psock_test_state(psock, SK_PSOCK_TX_ENABLED))) > > ^^^^^ > > Check for NULL > > > > 791 schedule_work(&psock->work); > > 792 write_space = psock->saved_write_space; > > ^^^^^^^^^^^^^^^^^^^^^^^^ > > > > 793 rcu_read_unlock(); > > 794 write_space(sk); > > ^^^^^^^^^^^^^^ > > The warning is on the wrong line. The dereference is really here. > > > > regards, > > dan carpenter > John, can you also take a look? Thanks Dan, seems there is a chance we could have a null psock here so we need to wrap both dereferences in the 'if (psock)'. I'll send a patch.