MPTCP Linux Development
 help / color / mirror / Atom feed
* [MPTCP] Re: [MPTCP][PATCH v2 mptcp-next] Squash to "mptcp: add rm_list in mptcp_out_options"
@ 2021-02-17  1:39 Mat Martineau
  0 siblings, 0 replies; 2+ messages in thread
From: Mat Martineau @ 2021-02-17  1:39 UTC (permalink / raw)
  To: mptcp 

[-- Attachment #1: Type: text/plain, Size: 2403 bytes --]

On Tue, 16 Feb 2021, Geliang Tang wrote:

> This patch fixed the following smatch warnings:
> net/mptcp/options.c:687 mptcp_established_options_rm_addr() error: uninitialized symbol 'align'.
>
> Reported-by: kernel test robot <lkp(a)intel.com>
> Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
> Signed-off-by: Geliang Tang <geliangtang(a)gmail.com>
> ---
> v2:
> - use roundup in mptcp_rm_addr_len

v2 looks good, thanks Geliang.


Mat


> ---
> net/mptcp/options.c  | 14 ++++++--------
> net/mptcp/protocol.h |  8 ++++++++
> 2 files changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/net/mptcp/options.c b/net/mptcp/options.c
> index e41410475f0e..73c712a5c6e6 100644
> --- a/net/mptcp/options.c
> +++ b/net/mptcp/options.c
> @@ -673,21 +673,19 @@ static bool mptcp_established_options_rm_addr(struct sock *sk,
> 	struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
> 	struct mptcp_sock *msk = mptcp_sk(subflow->conn);
> 	struct mptcp_rm_list rm_list;
> -	u8 i, align;
> +	int i, len;
>
> 	if (!mptcp_pm_should_rm_signal(msk) ||
> 	    !(mptcp_pm_rm_addr_signal(msk, remaining, &rm_list)))
> 		return false;
>
> -	if (rm_list.nr > 1)
> -		align = 5;
> -	if (rm_list.nr > 5)
> -		align = 9;
> -
> -	if (remaining < TCPOLEN_MPTCP_RM_ADDR_BASE + align)
> +	len = mptcp_rm_addr_len(rm_list);
> +	if (len < 0)
> +		return false;
> +	if (remaining < len)
> 		return false;
>
> -	*size = TCPOLEN_MPTCP_RM_ADDR_BASE + align;
> +	*size = len;
> 	opts->suboptions |= OPTION_MPTCP_RM_ADDR;
> 	opts->rm_list = rm_list;
>
> diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
> index dd6bc475f848..3f42b6f55f02 100644
> --- a/net/mptcp/protocol.h
> +++ b/net/mptcp/protocol.h
> @@ -708,6 +708,14 @@ static inline unsigned int mptcp_add_addr_len(int family, bool echo, bool port)
> 	return len;
> }
>
> +static inline int mptcp_rm_addr_len(struct mptcp_rm_list rm_list)
> +{
> +	if (rm_list.nr == 0 || rm_list.nr >= MPTCP_RM_IDS_MAX)
> +		return -EINVAL;
> +
> +	return TCPOLEN_MPTCP_RM_ADDR_BASE + roundup(rm_list.nr - 1, 4) + 1;
> +}
> +
> bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, unsigned int remaining,
> 			      struct mptcp_addr_info *saddr, bool *echo, bool *port);
> bool mptcp_pm_rm_addr_signal(struct mptcp_sock *msk, unsigned int remaining,
> -- 
> 2.29.2

--
Mat Martineau
Intel

^ permalink raw reply	[flat|nested] 2+ messages in thread
* [MPTCP] Re: [MPTCP][PATCH v2 mptcp-next] Squash to "mptcp: add rm_list in mptcp_out_options"
@ 2021-02-17 19:37 Matthieu Baerts
  0 siblings, 0 replies; 2+ messages in thread
From: Matthieu Baerts @ 2021-02-17 19:37 UTC (permalink / raw)
  To: mptcp 

[-- Attachment #1: Type: text/plain, Size: 859 bytes --]

Hi Geliang, Mat,

On 17/02/2021 02:39, Mat Martineau wrote:
> On Tue, 16 Feb 2021, Geliang Tang wrote:
> 
>> This patch fixed the following smatch warnings:
>> net/mptcp/options.c:687 mptcp_established_options_rm_addr() error: 
>> uninitialized symbol 'align'.
>>
>> Reported-by: kernel test robot <lkp(a)intel.com>
>> Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
>> Signed-off-by: Geliang Tang <geliangtang(a)gmail.com>
>> ---
>> v2:
>> - use roundup in mptcp_rm_addr_len
> 
> v2 looks good, thanks Geliang.

Thank you for the patch, the review and having reported the bug!

Now in our tree:

- 205001dc32f7: "squashed" in "mptcp: add rm_list in mptcp_out_options"
- Results: 3f93745ba205..230a407eae19

Tests + export have been queued!

Cheers,
Matt
-- 
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-02-17 19:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-17  1:39 [MPTCP] Re: [MPTCP][PATCH v2 mptcp-next] Squash to "mptcp: add rm_list in mptcp_out_options" Mat Martineau
  -- strict thread matches above, loose matches on Subject: below --
2021-02-17 19:37 Matthieu Baerts

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox