* [PATCH] bpf: add endian modifiers to fix endian warnings
@ 2022-07-14 10:51 Ben Dooks
2022-07-14 21:10 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Ben Dooks @ 2022-07-14 10:51 UTC (permalink / raw)
To: linux-kernel
Cc: Sudip Mukherjee, Jude Onyenegecha, Nicolas Ferre, Claudiu Beznea,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
netdev, Ben Dooks
A couple of the syscalls which load values (bpf_skb_load_helper_16
and bpf_skb_load_helper_32) are using u16/u32 types which are
triggering warnings as they are then converted from big-endian
to cpu-endian. Fix these by making the types __be instead.
Fixes the following sparse warnings:
net/core/filter.c:246:32: warning: cast to restricted __be16
net/core/filter.c:246:32: warning: cast to restricted __be16
net/core/filter.c:246:32: warning: cast to restricted __be16
net/core/filter.c:246:32: warning: cast to restricted __be16
net/core/filter.c:273:32: warning: cast to restricted __be32
net/core/filter.c:273:32: warning: cast to restricted __be32
net/core/filter.c:273:32: warning: cast to restricted __be32
net/core/filter.c:273:32: warning: cast to restricted __be32
net/core/filter.c:273:32: warning: cast to restricted __be32
net/core/filter.c:273:32: warning: cast to restricted __be32
Signed-off-by: Ben Dooks <ben.dooks@sifive.com>
---
net/core/filter.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/core/filter.c b/net/core/filter.c
index 5d16d66727fc..c971dfaed74b 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -237,7 +237,7 @@ BPF_CALL_2(bpf_skb_load_helper_8_no_cache, const struct sk_buff *, skb,
BPF_CALL_4(bpf_skb_load_helper_16, const struct sk_buff *, skb, const void *,
data, int, headlen, int, offset)
{
- u16 tmp, *ptr;
+ __be16 tmp, *ptr;
const int len = sizeof(tmp);
if (offset >= 0) {
@@ -264,7 +264,7 @@ BPF_CALL_2(bpf_skb_load_helper_16_no_cache, const struct sk_buff *, skb,
BPF_CALL_4(bpf_skb_load_helper_32, const struct sk_buff *, skb, const void *,
data, int, headlen, int, offset)
{
- u32 tmp, *ptr;
+ __be32 tmp, *ptr;
const int len = sizeof(tmp);
if (likely(offset >= 0)) {
--
2.35.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] bpf: add endian modifiers to fix endian warnings
2022-07-14 10:51 [PATCH] bpf: add endian modifiers to fix endian warnings Ben Dooks
@ 2022-07-14 21:10 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-07-14 21:10 UTC (permalink / raw)
To: Ben Dooks
Cc: linux-kernel, sudip.mukherjee, jude.onyenegecha, nicolas.ferre,
claudiu.beznea, davem, edumazet, kuba, pabeni, netdev
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:
On Thu, 14 Jul 2022 11:51:01 +0100 you wrote:
> A couple of the syscalls which load values (bpf_skb_load_helper_16
> and bpf_skb_load_helper_32) are using u16/u32 types which are
> triggering warnings as they are then converted from big-endian
> to cpu-endian. Fix these by making the types __be instead.
>
> Fixes the following sparse warnings:
>
> [...]
Here is the summary with links:
- bpf: add endian modifiers to fix endian warnings
https://git.kernel.org/bpf/bpf-next/c/96a233e600df
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] 2+ messages in thread
end of thread, other threads:[~2022-07-14 21:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-14 10:51 [PATCH] bpf: add endian modifiers to fix endian warnings Ben Dooks
2022-07-14 21: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
all inboxes | Powered by JetHome®