From: Eduard Zingerman <eddyz87@gmail.com>
To: Pu Lehui <pulehui@huaweicloud.com>,
bpf@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>, Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>,
Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
Jiri Olsa <jolsa@kernel.org>, Pu Lehui <pulehui@huawei.com>
Subject: Re: [PATCH bpf] selftests/bpf: Fix casting error when cross-compiling test_verifier for 32-bit platforms
Date: Tue, 08 Nov 2022 14:29:45 +0200 [thread overview]
Message-ID: <7db36fb7bbd9f079c117931a2de72aa78baf0578.camel@gmail.com> (raw)
In-Reply-To: <20221108121945.4104644-1-pulehui@huaweicloud.com>
On Tue, 2022-11-08 at 20:19 +0800, Pu Lehui wrote:
> From: Pu Lehui <pulehui@huawei.com>
>
> When cross-compiling test_verifier for 32-bit platforms, the casting error is shown below:
>
> test_verifier.c:1263:27: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
> 1263 | info.xlated_prog_insns = (__u64)*buf;
> | ^
> cc1: all warnings being treated as errors
>
> Fix it by adding zero-extension for it.
Looks good, sorry missed this case when coding this function...
>
> Fixes: 933ff53191eb ("selftests/bpf: specify expected instructions in test_verifier tests")
> Signed-off-by: Pu Lehui <pulehui@huawei.com>
> ---
> tools/testing/selftests/bpf/test_verifier.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c
> index 2dbcbf363c18..b605a70d4f6b 100644
> --- a/tools/testing/selftests/bpf/test_verifier.c
> +++ b/tools/testing/selftests/bpf/test_verifier.c
> @@ -1260,7 +1260,7 @@ static int get_xlated_program(int fd_prog, struct bpf_insn **buf, int *cnt)
>
> bzero(&info, sizeof(info));
> info.xlated_prog_len = xlated_prog_len;
> - info.xlated_prog_insns = (__u64)*buf;
> + info.xlated_prog_insns = (__u64)(unsigned long)*buf;
> if (bpf_obj_get_info_by_fd(fd_prog, &info, &info_len)) {
> perror("second bpf_obj_get_info_by_fd failed");
> goto out_free_buf;
next prev parent reply other threads:[~2022-11-08 12:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-08 12:19 [PATCH bpf] selftests/bpf: Fix casting error when cross-compiling test_verifier for 32-bit platforms Pu Lehui
2022-11-08 12:29 ` Eduard Zingerman [this message]
2022-11-08 14:45 ` Yonghong Song
2022-11-09 20:40 ` patchwork-bot+netdevbpf
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=7db36fb7bbd9f079c117931a2de72aa78baf0578.camel@gmail.com \
--to=eddyz87@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=pulehui@huawei.com \
--cc=pulehui@huaweicloud.com \
--cc=sdf@google.com \
--cc=song@kernel.org \
--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