mptcp.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] mptcp: fix 'masking a bool' warning
@ 2021-06-25 21:25 Mat Martineau
  2021-06-28  8:22 ` Paolo Abeni
  2021-06-28 20:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Mat Martineau @ 2021-06-25 21:25 UTC (permalink / raw)
  To: netdev
  Cc: Matthieu Baerts, davem, kuba, pabeni, mptcp, Dan Carpenter,
	Mat Martineau

From: Matthieu Baerts <matthieu.baerts@tessares.net>

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 not have a 'bool' type: 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>
Signed-off-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 ce0c45dfb79e..7bb82424e551 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.32.0


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

* Re: [PATCH net-next] mptcp: fix 'masking a bool' warning
  2021-06-25 21:25 [PATCH net-next] mptcp: fix 'masking a bool' warning Mat Martineau
@ 2021-06-28  8:22 ` Paolo Abeni
  2021-06-28 20:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Abeni @ 2021-06-28  8:22 UTC (permalink / raw)
  To: Mat Martineau, netdev; +Cc: Matthieu Baerts, davem, kuba, mptcp, Dan Carpenter

On Fri, 2021-06-25 at 14:25 -0700, Mat Martineau wrote:
> From: Matthieu Baerts <matthieu.baerts@tessares.net>
> 
> 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 not have a 'bool' type: 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>
> Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>

Acked-by: Paolo Abeni <pabeni@redhat.com>


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

* Re: [PATCH net-next] mptcp: fix 'masking a bool' warning
  2021-06-25 21:25 [PATCH net-next] mptcp: fix 'masking a bool' warning Mat Martineau
  2021-06-28  8:22 ` Paolo Abeni
@ 2021-06-28 20:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-06-28 20:10 UTC (permalink / raw)
  To: Mat Martineau
  Cc: netdev, matthieu.baerts, davem, kuba, pabeni, mptcp, dan.carpenter

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Fri, 25 Jun 2021 14:25:22 -0700 you wrote:
> From: Matthieu Baerts <matthieu.baerts@tessares.net>
> 
> 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 not have a 'bool' type: we should keep the 'u8' to allow
> this comparison.
> 
> [...]

Here is the summary with links:
  - [net-next] mptcp: fix 'masking a bool' warning
    https://git.kernel.org/netdev/net-next/c/c4512c63b119

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2021-06-28 20:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-25 21:25 [PATCH net-next] mptcp: fix 'masking a bool' warning Mat Martineau
2021-06-28  8:22 ` Paolo Abeni
2021-06-28 20:10 ` patchwork-bot+netdevbpf

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).