public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next v2] bpf: Fix 'dubious one-bit signed bitfield' warnings
@ 2022-07-11  8:12 Matthieu Baerts
  2022-07-11 15:47 ` Yonghong Song
  2022-07-12  4:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Matthieu Baerts @ 2022-07-11  8:12 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Eduard Zingerman
  Cc: mptcp, Matthieu Baerts, bpf, linux-kernel

Our CI[1] reported these warnings when using Sparse:

  $ touch net/mptcp/bpf.c
  $ make C=1 net/mptcp/bpf.o
  net/mptcp/bpf.c: note: in included file:
  include/linux/bpf_verifier.h:348:26: error: dubious one-bit signed bitfield
  include/linux/bpf_verifier.h:349:29: error: dubious one-bit signed bitfield

Set them as 'unsigned' to avoid warnings.

[1] https://github.com/multipath-tcp/mptcp_net-next/actions/runs/2643588487

Fixes: 1ade23711971 ("bpf: Inline calls to bpf_loop when callback is known")
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
---

Notes:
    v2: switch from 'bool' to 'unsigned int' (Yonghong Song)

 include/linux/bpf_verifier.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h
index 81b19669efba..2e3bad8640dc 100644
--- a/include/linux/bpf_verifier.h
+++ b/include/linux/bpf_verifier.h
@@ -345,10 +345,10 @@ struct bpf_verifier_state_list {
 };
 
 struct bpf_loop_inline_state {
-	int initialized:1; /* set to true upon first entry */
-	int fit_for_inline:1; /* true if callback function is the same
-			       * at each call and flags are always zero
-			       */
+	unsigned int initialized:1; /* set to true upon first entry */
+	unsigned int fit_for_inline:1; /* true if callback function is the same
+					* at each call and flags are always zero
+					*/
 	u32 callback_subprogno; /* valid when fit_for_inline is true */
 };
 
-- 
2.36.1


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

* Re: [PATCH bpf-next v2] bpf: Fix 'dubious one-bit signed bitfield' warnings
  2022-07-11  8:12 [PATCH bpf-next v2] bpf: Fix 'dubious one-bit signed bitfield' warnings Matthieu Baerts
@ 2022-07-11 15:47 ` Yonghong Song
  2022-07-12  4:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Yonghong Song @ 2022-07-11 15:47 UTC (permalink / raw)
  To: Matthieu Baerts, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Song Liu, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Eduard Zingerman
  Cc: mptcp, bpf, linux-kernel



On 7/11/22 1:12 AM, Matthieu Baerts wrote:
> Our CI[1] reported these warnings when using Sparse:
> 
>    $ touch net/mptcp/bpf.c
>    $ make C=1 net/mptcp/bpf.o
>    net/mptcp/bpf.c: note: in included file:
>    include/linux/bpf_verifier.h:348:26: error: dubious one-bit signed bitfield
>    include/linux/bpf_verifier.h:349:29: error: dubious one-bit signed bitfield
> 
> Set them as 'unsigned' to avoid warnings.
> 
> [1] https://github.com/multipath-tcp/mptcp_net-next/actions/runs/2643588487
> 
> Fixes: 1ade23711971 ("bpf: Inline calls to bpf_loop when callback is known")
> Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>

Acked-by: Yonghong Song <yhs@fb.com>

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

* Re: [PATCH bpf-next v2] bpf: Fix 'dubious one-bit signed bitfield' warnings
  2022-07-11  8:12 [PATCH bpf-next v2] bpf: Fix 'dubious one-bit signed bitfield' warnings Matthieu Baerts
  2022-07-11 15:47 ` Yonghong Song
@ 2022-07-12  4:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-07-12  4:30 UTC (permalink / raw)
  To: Matthieu Baerts
  Cc: ast, daniel, andrii, martin.lau, song, yhs, john.fastabend,
	kpsingh, sdf, haoluo, jolsa, eddyz87, mptcp, bpf, linux-kernel

Hello:

This patch was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:

On Mon, 11 Jul 2022 10:12:00 +0200 you wrote:
> Our CI[1] reported these warnings when using Sparse:
> 
>   $ touch net/mptcp/bpf.c
>   $ make C=1 net/mptcp/bpf.o
>   net/mptcp/bpf.c: note: in included file:
>   include/linux/bpf_verifier.h:348:26: error: dubious one-bit signed bitfield
>   include/linux/bpf_verifier.h:349:29: error: dubious one-bit signed bitfield
> 
> [...]

Here is the summary with links:
  - [bpf-next,v2] bpf: Fix 'dubious one-bit signed bitfield' warnings
    https://git.kernel.org/bpf/bpf-next/c/f16214c102f0

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:[~2022-07-12  4:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-11  8:12 [PATCH bpf-next v2] bpf: Fix 'dubious one-bit signed bitfield' warnings Matthieu Baerts
2022-07-11 15:47 ` Yonghong Song
2022-07-12  4:30 ` 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