diff options
author | Feng Yang <yangfeng@kylinos.cn> | 2024-09-03 15:25:59 +0800 |
---|---|---|
committer | Andrii Nakryiko <andrii@kernel.org> | 2024-09-04 12:58:46 -0700 |
commit | 23457b37ec3f9bb373d43cca61db371303726a1e (patch) | |
tree | b26b9769bd65c527e17aa2b77d645278bfde6af8 /tools/testing/selftests/bpf/prog_tests/module_fentry_shadow.c | |
parent | 6fee7a7e9ad8613251d74472fb5bd2c6464f234a (diff) |
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 <yangfeng@kylinos.cn>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20240903072559.292607-1-yangfeng59949@163.com
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.c | 3 |
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 aa9f67eb1c95b..bea05f78de5fd 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; |