mptcp.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH mptcp-next] mptcp: fix 'masking a bool' warning
@ 2021-06-25 11:53 Matthieu Baerts
  2021-06-25 15:43 ` Mat Martineau
  0 siblings, 1 reply; 3+ messages in thread
From: Matthieu Baerts @ 2021-06-25 11:53 UTC (permalink / raw)
  To: mptcp; +Cc: Paolo Abeni, Matthieu Baerts, Dan Carpenter

Dan Carpenter reported an issue introduced in
commit fde56eea01f9 ("mptcp: refine mptcp_cleanup_rbuf") where a new
boolean (ack_pending) is masked with 0x9.

This is not the intention to ignore values by using a boolean. This
variable should have a 'bool' type but we should keep the 'u8' to allow
this comparison.

Fixes: fde56eea01f9 ("mptcp: refine mptcp_cleanup_rbuf")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
---
 net/mptcp/protocol.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index ddce5b7bbefd..199a36fe4f69 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -455,7 +455,7 @@ static void mptcp_subflow_cleanup_rbuf(struct sock *ssk)
 static bool mptcp_subflow_could_cleanup(const struct sock *ssk, bool rx_empty)
 {
 	const struct inet_connection_sock *icsk = inet_csk(ssk);
-	bool ack_pending = READ_ONCE(icsk->icsk_ack.pending);
+	u8 ack_pending = READ_ONCE(icsk->icsk_ack.pending);
 	const struct tcp_sock *tp = tcp_sk(ssk);
 
 	return (ack_pending & ICSK_ACK_SCHED) &&
-- 
2.31.1


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

* Re: [PATCH mptcp-next] mptcp: fix 'masking a bool' warning
  2021-06-25 11:53 [PATCH mptcp-next] mptcp: fix 'masking a bool' warning Matthieu Baerts
@ 2021-06-25 15:43 ` Mat Martineau
  2021-06-25 15:57   ` Matthieu Baerts
  0 siblings, 1 reply; 3+ messages in thread
From: Mat Martineau @ 2021-06-25 15:43 UTC (permalink / raw)
  To: Matthieu Baerts; +Cc: mptcp, Paolo Abeni, Dan Carpenter


On Fri, 25 Jun 2021, Matthieu Baerts wrote:

> Dan Carpenter reported an issue introduced in
> commit fde56eea01f9 ("mptcp: refine mptcp_cleanup_rbuf") where a new
> boolean (ack_pending) is masked with 0x9.
>
> This is not the intention to ignore values by using a boolean. This
> variable should have a 'bool' type but we should keep the 'u8' to allow
            ^^^^^^
         "should not" ??

> this comparison.
>
> Fixes: fde56eea01f9 ("mptcp: refine mptcp_cleanup_rbuf")
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>

Thanks for catching this Dan!

I'll send to netdev today. Meanwhile, for the mptcp tree:

Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>

> ---
> net/mptcp/protocol.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index ddce5b7bbefd..199a36fe4f69 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -455,7 +455,7 @@ static void mptcp_subflow_cleanup_rbuf(struct sock *ssk)
> static bool mptcp_subflow_could_cleanup(const struct sock *ssk, bool rx_empty)
> {
> 	const struct inet_connection_sock *icsk = inet_csk(ssk);
> -	bool ack_pending = READ_ONCE(icsk->icsk_ack.pending);
> +	u8 ack_pending = READ_ONCE(icsk->icsk_ack.pending);
> 	const struct tcp_sock *tp = tcp_sk(ssk);
>
> 	return (ack_pending & ICSK_ACK_SCHED) &&
> -- 
> 2.31.1
>
>
>

--
Mat Martineau
Intel

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

* Re: [PATCH mptcp-next] mptcp: fix 'masking a bool' warning
  2021-06-25 15:43 ` Mat Martineau
@ 2021-06-25 15:57   ` Matthieu Baerts
  0 siblings, 0 replies; 3+ messages in thread
From: Matthieu Baerts @ 2021-06-25 15:57 UTC (permalink / raw)
  To: Mat Martineau; +Cc: mptcp, Paolo Abeni, Dan Carpenter

Hi Mat,

On 25/06/2021 17:43, Mat Martineau wrote:
> 
> On Fri, 25 Jun 2021, Matthieu Baerts wrote:
> 
>> Dan Carpenter reported an issue introduced in
>> commit fde56eea01f9 ("mptcp: refine mptcp_cleanup_rbuf") where a new
>> boolean (ack_pending) is masked with 0x9.
>>
>> This is not the intention to ignore values by using a boolean. This
>> variable should have a 'bool' type but we should keep the 'u8' to allow
>            ^^^^^^
>         "should not" ??

Good catch!

>> this comparison.
>>
>> Fixes: fde56eea01f9 ("mptcp: refine mptcp_cleanup_rbuf")
>> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
>> Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
> 
> Thanks for catching this Dan!
> 
> I'll send to netdev today. Meanwhile, for the mptcp tree:
> 
> Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>

Thank you, just applied in our tree (fix for net-next) without the typo
and with your RvB tag:

- 320bd34a848a: mptcp: fix 'masking a bool' warning

- Results: a12d33111689..28e592bb887e


Builds and tests are now in progress:



https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export/20210625T155645

https://github.com/multipath-tcp/mptcp_net-next/actions/workflows/build-validation.yml?query=branch:export/20210625T155645

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

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

end of thread, other threads:[~2021-06-25 15:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-25 11:53 [PATCH mptcp-next] mptcp: fix 'masking a bool' warning Matthieu Baerts
2021-06-25 15:43 ` Mat Martineau
2021-06-25 15:57   ` Matthieu Baerts

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).