[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7db36fb7bbd9f079c117931a2de72aa78baf0578.camel@gmail.com>
Date: Tue, 08 Nov 2022 14:29:45 +0200
From: Eduard Zingerman <eddyz87@...il.com>
To: Pu Lehui <pulehui@...weicloud.com>, bpf@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <martin.lau@...ux.dev>,
Song Liu <song@...nel.org>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...gle.com>,
Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
Pu Lehui <pulehui@...wei.com>
Subject: Re: [PATCH bpf] selftests/bpf: Fix casting error when
cross-compiling test_verifier for 32-bit platforms
On Tue, 2022-11-08 at 20:19 +0800, Pu Lehui wrote:
> From: Pu Lehui <pulehui@...wei.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@...wei.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;
Powered by blists - more mailing lists