mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
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
This commit is contained in:
committed by
Andrii Nakryiko
parent
6fee7a7e9a
commit
23457b37ec
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user