,On Sun, 23 Oct 2022, Geliang Tang wrote:
> Use '(struct sock *)msk' to get 'sk' from 'msk' in a more direct way
> instead of using '&msk->sk.icsk_inet.sk' in mptcp_nl_cmd_sf_create()
> and mptcp_nl_cmd_sf_destroy().
>
> Signed-off-by: Geliang Tang <geliang.tang@suse.com>
Hi Geliang -
This is a good cleanup, thanks. We use the struct sock * cast almost
everywhere. Can you extend this patch to also change the similar
statements in sockopt.c and protocol.c?
(I think the assignment in mptcp_retransmit_timer() should stay unchanged)
- Mat
> ---
> v2:
> - fix the "uninitialized use occurs" error reported by kernel test robot
> <lkp@intel.com>
> ---
> net/mptcp/pm_userspace.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c
> index 9e82250cbb70..5cb65f0928f4 100644
> --- a/net/mptcp/pm_userspace.c
> +++ b/net/mptcp/pm_userspace.c
> @@ -291,7 +291,7 @@ int mptcp_nl_cmd_sf_create(struct sk_buff *skb, struct genl_info *info)
> goto create_err;
> }
>
> - sk = &msk->sk.icsk_inet.sk;
> + sk = (struct sock *)msk;
> lock_sock(sk);
>
> err = __mptcp_subflow_connect(sk, &addr_l, &addr_r);
> @@ -403,7 +403,7 @@ int mptcp_nl_cmd_sf_destroy(struct sk_buff *skb, struct genl_info *info)
> goto destroy_err;
> }
>
> - sk = &msk->sk.icsk_inet.sk;
> + sk = (struct sock *)msk;
> lock_sock(sk);
> ssk = mptcp_nl_find_ssk(msk, &addr_l, &addr_r);
> if (ssk) {
> --
> 2.35.3
>
>
>
--
Mat Martineau
Intel