Message ID | 078a2ef5bdc4e3b2c25ef852461692001f426495.1604976945.git.geliangtang@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [MPTCP,v2,net-next] mptcp: fix static checker warnings in mptcp_pm_add_timer | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net-next |
netdev/subject_prefix | success | Link |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 1 this patch: 1 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | warning | WARNING: line length of 83 exceeds 80 columns |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 1 this patch: 1 |
netdev/header_inline | success | Link |
netdev/stable | success | Stable not CCed |
On Tue, 10 Nov 2020 11:01:43 +0800 Geliang Tang wrote: > Fix the following Smatch complaint: > > net/mptcp/pm_netlink.c:213 mptcp_pm_add_timer() > warn: variable dereferenced before check 'msk' (see line 208) > > net/mptcp/pm_netlink.c > 207 struct mptcp_sock *msk = entry->sock; > 208 struct sock *sk = (struct sock *)msk; > 209 struct net *net = sock_net(sk); > ^^ > "msk" dereferenced here. > > 210 > 211 pr_debug("msk=%p", msk); > 212 > 213 if (!msk) > ^^^^ > Too late. > > 214 return; > 215 > > Fixes: 93f323b9cccc ("mptcp: add a new sysctl add_addr_timeout") > Reported-by: Dan Carpenter <dan.carpenter@oracle.com> > Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> > Reviewed-by: Matthieu Baerts <matthieu.baerts@tessares.net> > Signed-off-by: Geliang Tang <geliangtang@gmail.com> Applied, thanks!
diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index ed60538df7b2..446ef8f07734 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -206,7 +206,6 @@ static void mptcp_pm_add_timer(struct timer_list *timer) struct mptcp_pm_add_entry *entry = from_timer(entry, timer, add_timer); struct mptcp_sock *msk = entry->sock; struct sock *sk = (struct sock *)msk; - struct net *net = sock_net(sk); pr_debug("msk=%p", msk); @@ -234,7 +233,7 @@ static void mptcp_pm_add_timer(struct timer_list *timer) if (entry->retrans_times < ADD_ADDR_RETRANS_MAX) sk_reset_timer(sk, timer, - jiffies + mptcp_get_add_addr_timeout(net)); + jiffies + mptcp_get_add_addr_timeout(sock_net(sk))); spin_unlock_bh(&msk->pm.lock);