aboutsummaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/progs/getpeername_unix_prog.c
diff options
context:
space:
mode:
authorAndrii Nakryiko <andrii@kernel.org>2024-01-30 13:20:23 -0800
committerMartin KaFai Lau <martin.lau@kernel.org>2024-01-30 15:55:50 -0800
commitea9d561686fbd0e1ddf05d861d8f2c1ae8291870 (patch)
treea894b1c60e0bfa06e3acb82179271039dbedd3e3 /tools/testing/selftests/bpf/progs/getpeername_unix_prog.c
parent20d59ee55172fdf6072abf871fa62b2070d6383f (diff)
selftests/bpf: convert bpf_rdonly_cast() uses to bpf_core_cast() macro
Use more ergonomic bpf_core_cast() macro instead of bpf_rdonly_cast() in selftests code. Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/r/20240130212023.183765-3-andrii@kernel.org Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/progs/getpeername_unix_prog.c')
-rw-r--r--tools/testing/selftests/bpf/progs/getpeername_unix_prog.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/tools/testing/selftests/bpf/progs/getpeername_unix_prog.c b/tools/testing/selftests/bpf/progs/getpeername_unix_prog.c
index 9c078f34bbb2..5a76754f846b 100644
--- a/tools/testing/selftests/bpf/progs/getpeername_unix_prog.c
+++ b/tools/testing/selftests/bpf/progs/getpeername_unix_prog.c
@@ -27,8 +27,7 @@ int getpeername_unix_prog(struct bpf_sock_addr *ctx)
if (sa_kern->uaddrlen != unaddrlen)
return 1;
- sa_kern_unaddr = bpf_rdonly_cast(sa_kern->uaddr,
- bpf_core_type_id_kernel(struct sockaddr_un));
+ sa_kern_unaddr = bpf_core_cast(sa_kern->uaddr, struct sockaddr_un);
if (memcmp(sa_kern_unaddr->sun_path, SERVUN_REWRITE_ADDRESS,
sizeof(SERVUN_REWRITE_ADDRESS) - 1) != 0)
return 1;