* [PATCH bpf v2] selftests/bpf: Fix xdp_synproxy compilation failure in 32-bit arch
@ 2022-11-11 3:08 Yang Jihong
2022-11-11 7:29 ` Yonghong Song
2022-11-11 20:40 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Yang Jihong @ 2022-11-11 3:08 UTC (permalink / raw)
To: ast, daniel, davem, kuba, hawk, john.fastabend, andrii,
martin.lau, song, yhs, kpsingh, sdf, haoluo, jolsa, mykolal,
shuah, tariqt, maximmi, netdev, bpf, linux-kselftest,
linux-kernel
Cc: yangjihong1
xdp_synproxy fails to be compiled in the 32-bit arch, log is as follows:
xdp_synproxy.c: In function 'parse_options':
xdp_synproxy.c:175:36: error: left shift count >= width of type [-Werror=shift-count-overflow]
175 | *tcpipopts = (mss6 << 32) | (ttl << 24) | (wscale << 16) | mss4;
| ^~
xdp_synproxy.c: In function 'syncookie_open_bpf_maps':
xdp_synproxy.c:289:28: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
289 | .map_ids = (__u64)map_ids,
| ^
Fix it.
Fixes: fb5cd0ce70d4 ("selftests/bpf: Add selftests for raw syncookie helpers")
Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
---
tools/testing/selftests/bpf/xdp_synproxy.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/bpf/xdp_synproxy.c b/tools/testing/selftests/bpf/xdp_synproxy.c
index ff35320d2be9..410a1385a01d 100644
--- a/tools/testing/selftests/bpf/xdp_synproxy.c
+++ b/tools/testing/selftests/bpf/xdp_synproxy.c
@@ -104,7 +104,8 @@ static void parse_options(int argc, char *argv[], unsigned int *ifindex, __u32 *
{ "tc", no_argument, NULL, 'c' },
{ NULL, 0, NULL, 0 },
};
- unsigned long mss4, mss6, wscale, ttl;
+ unsigned long mss4, wscale, ttl;
+ unsigned long long mss6;
unsigned int tcpipopts_mask = 0;
if (argc < 2)
@@ -286,7 +287,7 @@ static int syncookie_open_bpf_maps(__u32 prog_id, int *values_map_fd, int *ports
prog_info = (struct bpf_prog_info) {
.nr_map_ids = 8,
- .map_ids = (__u64)map_ids,
+ .map_ids = (__u64)(unsigned long)map_ids,
};
info_len = sizeof(prog_info);
--
2.30.GIT
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH bpf v2] selftests/bpf: Fix xdp_synproxy compilation failure in 32-bit arch
2022-11-11 3:08 [PATCH bpf v2] selftests/bpf: Fix xdp_synproxy compilation failure in 32-bit arch Yang Jihong
@ 2022-11-11 7:29 ` Yonghong Song
2022-11-11 20:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Yonghong Song @ 2022-11-11 7:29 UTC (permalink / raw)
To: Yang Jihong, ast, daniel, davem, kuba, hawk, john.fastabend,
andrii, martin.lau, song, yhs, kpsingh, sdf, haoluo, jolsa,
mykolal, shuah, tariqt, maximmi, netdev, bpf, linux-kselftest,
linux-kernel
On 11/10/22 7:08 PM, Yang Jihong wrote:
> xdp_synproxy fails to be compiled in the 32-bit arch, log is as follows:
>
> xdp_synproxy.c: In function 'parse_options':
> xdp_synproxy.c:175:36: error: left shift count >= width of type [-Werror=shift-count-overflow]
> 175 | *tcpipopts = (mss6 << 32) | (ttl << 24) | (wscale << 16) | mss4;
> | ^~
> xdp_synproxy.c: In function 'syncookie_open_bpf_maps':
> xdp_synproxy.c:289:28: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
> 289 | .map_ids = (__u64)map_ids,
> | ^
>
> Fix it.
>
> Fixes: fb5cd0ce70d4 ("selftests/bpf: Add selftests for raw syncookie helpers")
> Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
Acked-by: Yonghong Song <yhs@fb.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH bpf v2] selftests/bpf: Fix xdp_synproxy compilation failure in 32-bit arch
2022-11-11 3:08 [PATCH bpf v2] selftests/bpf: Fix xdp_synproxy compilation failure in 32-bit arch Yang Jihong
2022-11-11 7:29 ` Yonghong Song
@ 2022-11-11 20:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-11-11 20:40 UTC (permalink / raw)
To: Yang Jihong
Cc: ast, daniel, davem, kuba, hawk, john.fastabend, andrii,
martin.lau, song, yhs, kpsingh, sdf, haoluo, jolsa, mykolal,
shuah, tariqt, maximmi, netdev, bpf, linux-kselftest,
linux-kernel
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:
On Fri, 11 Nov 2022 11:08:36 +0800 you wrote:
> xdp_synproxy fails to be compiled in the 32-bit arch, log is as follows:
>
> xdp_synproxy.c: In function 'parse_options':
> xdp_synproxy.c:175:36: error: left shift count >= width of type [-Werror=shift-count-overflow]
> 175 | *tcpipopts = (mss6 << 32) | (ttl << 24) | (wscale << 16) | mss4;
> | ^~
> xdp_synproxy.c: In function 'syncookie_open_bpf_maps':
> xdp_synproxy.c:289:28: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
> 289 | .map_ids = (__u64)map_ids,
> | ^
>
> [...]
Here is the summary with links:
- [bpf,v2] selftests/bpf: Fix xdp_synproxy compilation failure in 32-bit arch
https://git.kernel.org/bpf/bpf-next/c/e4c9cf0ce8c4
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-11-11 20:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-11 3:08 [PATCH bpf v2] selftests/bpf: Fix xdp_synproxy compilation failure in 32-bit arch Yang Jihong
2022-11-11 7:29 ` Yonghong Song
2022-11-11 20:40 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox