diff options
| author | Guo Zhengkui <[email protected]> | 2022-03-15 13:01:26 +0000 |
|---|---|---|
| committer | Daniel Borkmann <[email protected]> | 2022-03-15 16:03:10 +0000 |
| commit | f98d6dd1e79d4b04c2e13e91a9348473cfa805a6 (patch) | |
| tree | 75ac48a710e482fbff0424c22a25addd29fc2075 /tools/testing/selftests/bpf/prog_tests/cgroup_attach_multi.c | |
| parent | samples/bpf, xdpsock: Fix race when running for fix duration of time (diff) | |
| download | kernel-f98d6dd1e79d4b04c2e13e91a9348473cfa805a6.tar.gz kernel-f98d6dd1e79d4b04c2e13e91a9348473cfa805a6.zip | |
selftests/bpf: Clean up array_size.cocci warnings
Clean up the array_size.cocci warnings under tools/testing/selftests/bpf/:
Use `ARRAY_SIZE(arr)` instead of forms like `sizeof(arr)/sizeof(arr[0])`.
tools/testing/selftests/bpf/test_cgroup_storage.c uses ARRAY_SIZE() defined
in tools/include/linux/kernel.h (sys/sysinfo.h -> linux/kernel.h), while
others use ARRAY_SIZE() in bpf_util.h.
Signed-off-by: Guo Zhengkui <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/cgroup_attach_multi.c')
| -rw-r--r-- | tools/testing/selftests/bpf/prog_tests/cgroup_attach_multi.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/cgroup_attach_multi.c b/tools/testing/selftests/bpf/prog_tests/cgroup_attach_multi.c index 38b3c47293da..db0b7bac78d1 100644 --- a/tools/testing/selftests/bpf/prog_tests/cgroup_attach_multi.c +++ b/tools/testing/selftests/bpf/prog_tests/cgroup_attach_multi.c @@ -63,7 +63,7 @@ static int prog_load_cnt(int verdict, int val) BPF_MOV64_IMM(BPF_REG_0, verdict), /* r0 = verdict */ BPF_EXIT_INSN(), }; - size_t insns_cnt = sizeof(prog) / sizeof(struct bpf_insn); + size_t insns_cnt = ARRAY_SIZE(prog); int ret; ret = bpf_test_load_program(BPF_PROG_TYPE_CGROUP_SKB, |
