net: bpf: type fixes for __be16/__be32
Subsystems (4)
PATCH 1/1 net: bpf: type fixes for __be16/__be32
In bpf_skb_load_helper_8_no_cache andbpf_skb_load_helper_16_no_cache they
read a u16/u32 where actually these
are __be16 and __be32.
Fix the following by making the types
match:
net/core/filter.c:215:32: warning: cast to restricted __be16 net/core/filter.c:215:32: warning: cast to restricted __be16 net/core/filter.c:215:32: warning: cast to restricted __be16 net/core/filter.c:215:32: warning: cast to restricted __be16 net/core/filter.c:215:32: warning: cast to restricted __be16 net/core/filter.c:215:32: warning: cast to restricted __be16 net/core/filter.c:215:32: warning: cast to restricted __be16 net/core/filter.c:215:32: warning: cast to restricted __be16 net/core/filter.c:242:32: warning: cast to restricted __be32 net/core/filter.c:242:32: warning: cast to restricted __be32 net/core/filter.c:242:32: warning: cast to restricted __be32 net/core/filter.c:242:32: warning: cast to restricted __be32 net/core/filter.c:242:32: warning: cast to restricted __be32 net/core/filter.c:242:32: warning: cast to restricted __be32 net/core/filter.c:242:32: warning: cast to restricted __be32 net/core/filter.c:242:32: warning: cast to restricted __be32 net/core/filter.c:242:32: warning: cast to restricted __be32 net/core/filter.c:242:32: warning: cast to restricted __be32 net/core/filter.c:242:32: warning: cast to restricted __be32 net/core/filter.c:242:32: warning: cast to restricted __be32
---
Cc: Alexei Starovoitov <[email protected]>
Cc: Daniel Borkmann <[email protected]>
Cc: Martin KaFai Lau <[email protected]>
Cc: Song Liu <[email protected]>
Cc: Yonghong Song <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- net/core/filter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/core/filter.c +2 -2
@@ -205,7 +205,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 ) {
@@ -232,7 +232,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 )) {
Signature · 1 line
2.23.0
Quoted 20 lines · Ben Dooks (Codethink)
In
bpf_skb_load_helper_8_no_cacheandbpf_skb_load_helper_16_no_cachethey
read a u16/u32 where actually these
are__be16and__be32.Fix the following by making the types
match:
net/core/filter.c:215:32: warning: cast to restricted__be16net/core/filter.c:215:32: warning: cast to restricted__be16net/core/filter.c:215:32: warning: cast to restricted__be16net/core/filter.c:215:32: warning: cast to restricted__be16net/core/filter.c:215:32: warning: cast to restricted__be16net/core/filter.c:215:32: warning: cast to restricted__be16net/core/filter.c:215:32: warning: cast to restricted__be16net/core/filter.c:215:32: warning: cast to restricted__be16net/core/filter.c:242:32: warning: cast to restricted__be32net/core/filter.c:242:32: warning: cast to restricted__be32net/core/filter.c:242:32: warning: cast to restricted__be32net/core/filter.c:242:32: warning: cast to restricted__be32
Quoted 8 lines
net/core/filter.c:242:32: warning: cast to restricted__be32net/core/filter.c:242:32: warning: cast to restricted__be32net/core/filter.c:242:32: warning: cast to restricted__be32net/core/filter.c:242:32: warning: cast to restricted__be32net/core/filter.c:242:32: warning: cast to restricted__be32net/core/filter.c:242:32: warning: cast to restricted__be32net/core/filter.c:242:32: warning: cast to restricted__be32net/core/filter.c:242:32: warning: cast to restricted__be32