From: Stanislav Fomichev <sdf@google.com>
To: Ben Dooks <ben.dooks@codethink.co.uk>
Cc: ast@kernel.org, daniel@iogearbox.net, bpf@vger.kernel.org
Subject: Re: [PATCH] bpf: remove trunctaiton warning in BPF_LD_IMM64_RAW
Date: Thu, 14 Mar 2024 12:58:12 -0700 [thread overview]
Message-ID: <ZfNW1GDMlRW2K__p@google.com> (raw)
In-Reply-To: <20240314103153.2489252-1-ben.dooks@codethink.co.uk>
On 03/14, Ben Dooks wrote:
> When building W=1, the following warningds get generated by lib/test_bpf.c
> due to the BPF_LD_IMM64_RAW() truncating a 64bit to 32bit value without
> a specific mask to do so.
>
> lib/test_bpf.c:6441:25: warning: cast truncates bits from constant value (ffffffff0000 becomes ffff0000)
> lib/test_bpf.c:6442:25: warning: cast truncates bits from constant value (ffffffff0000 becomes ffff0000)
> lib/test_bpf.c:6473:25: warning: cast truncates bits from constant value (123456789abcdef becomes 89abcdef)
> lib/test_bpf.c:6489:25: warning: cast truncates bits from constant value (123456789abcdef becomes 89abcdef)
> lib/test_bpf.c:6490:25: warning: cast truncates bits from constant value (123456780a0c0e0 becomes 80a0c0e0)
> lib/test_bpf.c:6599:25: warning: cast truncates bits from constant value (123456789abcdef becomes 89abcdef)
> lib/test_bpf.c:6637:25: warning: cast truncates bits from constant value (ffffffff0000 becomes ffff0000)
>
> (more warnings truncated)
>
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
I wonder how many other places (in the kernel) we have where we silently
cast u64 to u32.. Surprised that's the only warning you get :-)
Acked-by: Stanislav Fomichev <sdf@google.com>
next prev parent reply other threads:[~2024-03-14 19:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-14 10:31 [PATCH] bpf: remove trunctaiton warning in BPF_LD_IMM64_RAW Ben Dooks
2024-03-14 19:58 ` Stanislav Fomichev [this message]
2024-03-14 22:08 ` Alexei Starovoitov
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=ZfNW1GDMlRW2K__p@google.com \
--to=sdf@google.com \
--cc=ast@kernel.org \
--cc=ben.dooks@codethink.co.uk \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
/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