aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/prog_tests/module_fentry_shadow.c
diff options
context:
space:
mode:
authorFeng Yang <[email protected]>2024-09-03 07:25:59 +0000
committerAndrii Nakryiko <[email protected]>2024-09-04 19:58:46 +0000
commit23457b37ec3f9bb373d43cca61db371303726a1e (patch)
treeb26b9769bd65c527e17aa2b77d645278bfde6af8 /tools/testing/selftests/bpf/prog_tests/module_fentry_shadow.c
parentMerge branch 'bpf-follow-up-on-gen_epilogue' (diff)
downloadkernel-23457b37ec3f9bb373d43cca61db371303726a1e.tar.gz
kernel-23457b37ec3f9bb373d43cca61db371303726a1e.zip
selftests: bpf: Replace sizeof(arr)/sizeof(arr[0]) with ARRAY_SIZE
The ARRAY_SIZE macro is more compact and more formal in linux source. Signed-off-by: Feng Yang <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/module_fentry_shadow.c')
-rw-r--r--tools/testing/selftests/bpf/prog_tests/module_fentry_shadow.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/module_fentry_shadow.c b/tools/testing/selftests/bpf/prog_tests/module_fentry_shadow.c
index aa9f67eb1c95..bea05f78de5f 100644
--- a/tools/testing/selftests/bpf/prog_tests/module_fentry_shadow.c
+++ b/tools/testing/selftests/bpf/prog_tests/module_fentry_shadow.c
@@ -4,6 +4,7 @@
#include <bpf/btf.h>
#include "bpf/libbpf_internal.h"
#include "cgroup_helpers.h"
+#include "bpf_util.h"
static const char *module_name = "bpf_testmod";
static const char *symbol_name = "bpf_fentry_shadow_test";
@@ -100,7 +101,7 @@ void test_module_fentry_shadow(void)
load_opts.attach_btf_obj_fd = btf_fd[i];
prog_fd[i] = bpf_prog_load(BPF_PROG_TYPE_TRACING, NULL, "GPL",
trace_program,
- sizeof(trace_program) / sizeof(struct bpf_insn),
+ ARRAY_SIZE(trace_program),
&load_opts);
if (!ASSERT_GE(prog_fd[i], 0, "bpf_prog_load"))
goto out;