From: "Ben Dooks (Codethink)" <ben.dooks@codethink.co.uk>
To: linux-kernel@lists.codethink.co.uk
Cc: "Ben Dooks (Codethink)" <ben.dooks@codethink.co.uk>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
Yonghong Song <yhs@fb.com>,
"David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, bpf@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] net: bpf: type fixes for __be16/__be32
Date: Wed, 16 Oct 2019 12:16:35 +0100 [thread overview]
Message-ID: <20191016111635.20089-1-ben.dooks@codethink.co.uk> (raw)
In bpf_skb_load_helper_8_no_cache and
bpf_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
Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Martin KaFai Lau <kafai@fb.com>
Cc: Song Liu <songliubraving@fb.com>
Cc: Yonghong Song <yhs@fb.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Cc: bpf@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
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 f7338fee41f8..eefb1545b4c6 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -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)) {
--
2.23.0
next reply other threads:[~2019-10-16 11:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-16 11:16 Ben Dooks (Codethink) [this message]
2019-10-17 17:12 ` [PATCH] net: bpf: type fixes for __be16/__be32 Martin Lau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191016111635.20089-1-ben.dooks@codethink.co.uk \
--to=ben.dooks@codethink.co.uk \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=kafai@fb.com \
--cc=linux-kernel@lists.codethink.co.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=songliubraving@fb.com \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).